Solution:
1. Install the cv2 package with
pip3 install --upgrade opencv-python
2. OR,
pip install --upgrade opencv-python
3. OR, If you're using a virtual or conda environment then use
Python: Create Terminal
and install cv2
either using conda or python -m pip install --upgrade opencv-python
.Reference issue:
1. https://github.com/Microsoft/vscode-python/issues/1993
2. https://github.com/DonJayamanne/pythonVSCode/issues/623
Problem 2: cv2 module members are not recognized (Python on Visual Studio Code)
Solution:
1. Use the Cmd+shift+p shortcut (or ctrl instead of cmd) and type "open settings (json)".
2. Add this line to the settings:
"python.linting.pylintArgs": ["--extension-pkg-whitelist=cv2"]
Reference Issue: 1. https://github.com/PyCQA/pylint/issues/2426
2. https://github.com/DonJayamanne/pythonVSCode/issues/623