-1

I'm having trouble getting opencv to work in pycharm. I've installed it in the terminal using the pip command and it seems to be installed, however when i start coding i get warning messages when i try use the opencv commands:

Cannot find reference 'imread' in '__init__.py' 

Is there a fix for this?

image of pycharm IDE with code, python packages and warning message

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36

1 Answers1

0

That's not really a warning (definitely not in the Python sense).

This just means Pycharm's introspection can't find definitions for that module. This in turn is because it's a compiled module (OpenCV is a C++ project with wrappers for Python) so the "usual" Python source files (for introspection) isn't an option.

For a much deeper discussion and some recent workarounds, see the Github issue on adding Python typing stubs to OpenCV.

declension
  • 4,110
  • 22
  • 25