The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Anybody can ask a question
Anybody can answer
The best answers are voted up and moderated by our team

Capstone Project Computer Vision coin classification– Starting to work with Visual Studio

Capstone Project Computer Vision coin classification– Starting to work with Visual Studio

Super Learner


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::

  1. img = cv2.imread(‘capstone_coins.png’,cv2.IMREAD_GRAYSCALE)
  2. original_image = cv2.imread(‘capstone_coins.png’,1)
  3. img = cv2.GaussianBlur(img, (5,5), 0)
  4. cv2.imshow(‘Detected Coins’, img)

I Receive the following errors :

  1. {“Module ‘cv2’ has no ‘imread’ member“,
    “source”: “pylint”,
    “startLineNumber”: 4,
    “startColumn”: 7,
  2. Module ‘cv2’ has no ‘IMREAD_GRAYSCALE’ member“,
    “source”: “pylint”,
    “startLineNumber”: 4,
    “startColumn”: 39,
    “endLineNumber”: 4,
    “endColumn”: 39
  3. Module ‘cv2’ has no ‘GaussianBlur’ member“,
    “source”: “pylint”,
    “startLineNumber”: 6,
    “startColumn”: 7,
    “endLineNumber”: 6,
    “endColumn”: 7
  4. “message”: “Module ‘cv2’ has no ‘imshow’ member”,
    “source”: “pylint”,
    “startLineNumber”: 7,
    “startColumn”: 1,
    “endLineNumber”: 7,
    “endColumn”: 1

In summary:

  1. 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)
  2. BUT, I run the ensuing code I get an cv2 has no “imread’ member error or imread_GRAYSCALE member ( see attached screenshot error_2)
  3. 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!!



1 Answer

Super Learner

Partial update,
After attempting the following troubleshoot method:

  1. On VScode: CTRL + Shift + P
  2. Choose “Preferences: Open Settings (JSON)”
  3. Add this line into JSON file: “python.linting.pylintArgs”: [“–generate-members”]

I was able to create  the two variables img and original_image successfully.
However, when trying to run “img” as a blurred grayscale image with: img = cv2.GaussianBlur(img, (5,5), 0) –> I get the following Traceback error:
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\core\src\matrix.cpp:757: error: (-215:Assertion failed) dims <= 2 && step[0] > 0 in function ‘cv::Mat::locateROI’
Making progress but still troubleshooting. Part of enjoying the process and not the destination!

Learn Data Science
this Summer!
Get 50% OFF