Capstone Project Computer Vision coin classification– Starting to work with Visual Studio
Hello,
I have installed OpenCV and VS Code correctly --> and am running VS Code out of the proper environment from my Anaconda Navigator.
HOWEVER, once inside Visual Studio--> I still have an issue with the first two import commands-- 1) import numpy as np and 2) import cv2-- with the knock on effect rendering errors to the ensuing code.
When I try to run the ensuing code as follows::
- img = cv2.imread('capstone_coins.png',cv2.IMREAD_GRAYSCALE)
- original_image = cv2.imread('capstone_coins.png',1)
- img = cv2.GaussianBlur(img, (5,5), 0)
- cv2.imshow('Detected Coins', img)
I Receive the following errors :
- {"Module 'cv2' has no 'imread' member",
"source": "pylint",
"startLineNumber": 4,
"startColumn": 7, - Module 'cv2' has no 'IMREAD_GRAYSCALE' member",
"source": "pylint",
"startLineNumber": 4,
"startColumn": 39,
"endLineNumber": 4,
"endColumn": 39 - Module 'cv2' has no 'GaussianBlur' member",
"source": "pylint",
"startLineNumber": 6,
"startColumn": 7,
"endLineNumber": 6,
"endColumn": 7 - "message": "Module 'cv2' has no 'imshow' member",
"source": "pylint",
"startLineNumber": 7,
"startColumn": 1,
"endLineNumber": 7,
"endColumn": 1
In summary:
- When I run the "import numpy as np" and " import cv2" lines-- everything seems fine as in no errors in the: i) terminal or 2) "problems" tabs (see screen shot 1 attached)
- BUT, I run the ensuing code I get an cv2 has no "imread' member error or imread_GRAYSCALE member ( see attached screenshot error_2)
- Then as I run further code Ireceive an error for both "cv2 has no gaussianblur" member and cv2 has no "imshow" member ( see attached screenshot error_3)
--> This leads me to believe that cv2 was not properly imported from the start??
Any help would be greatly appreciated... I have been stuck on this issue for many days and have tried multiple debugging methods and alternatives-- to no avail!!
Thanks,
Matt
- On VScode: CTRL + Shift + P
- Choose "Preferences: Open Settings (JSON)"
- Add this line into JSON file: "python.linting.pylintArgs": ["--generate-members"]
!_src.empty() in function 'cv::GaussianBlur' Thanks for the attention
Hi, I ran into the same issue. I still haven't found anyone with a solution on making the code run smoothly like Giles did. Anyone have an update or a solution?