Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot find reference for opencv functions in pycharm

I have opencv-python installed and the .pyd file is added in the site-packages and the DLLs. The code works with images. When I want to read, show, write an image it works. But I get a warning that the functions' references cannot be found in init.py . Due to this, I can not use the auto-complete feature. Could someone help me out? I am using opencv 3.4.0 and python 3.6.4 in pycharm. I downloaded opencv via pip in the command prompt.

like image 537
prog Avatar asked Feb 13 '18 17:02

prog


2 Answers

The problem is caused by CV2 and how init.py does the imports. Just ignore the warnings the app will work the same. Or you can do an import with alias like

import cv2.cv2 as cv2

If you have a warning on it press Alt+Return to install and fix it. Now you will have the autocomplete and no other warnings (about that) on the project.

like image 200
Jox Avatar answered Oct 05 '22 23:10

Jox


Import cv2 as follows:

from cv2 import cv2
like image 33
Edwin Acevedo Avatar answered Oct 06 '22 01:10

Edwin Acevedo