I need to code a quick script for facial recognition. I imported the following modules (as seen in the picture below)
But pycharm says that there are no modules named face_recognition, cv2, unsolved reference path and imutils.
I don't know what the issue might be since I am super sure I installed opencv and face recognition on my laptop.
Thanks.
For example, I checked my current cv2 version and the result was this
import cv2
cv2. version
'4.7.0'
Related
I followed this guide to install opencv (version 3.4.4) and the contrib modules because I want to work with the SIFT algorithm.
https://www.pyimagesearch.com/2018/05/28/ubuntu-18-04-how-to-install-opencv/
When I noticed, it was not working as expected after the installation, I deleted the build folder and tried again, but this did not work as well.
I imported like this:
import cv2 as cv
I tried to use SIFT (in python 3.6) in the following ways:
sift = cv.SIFT_create()
sift = cv.xfeatures2d.SIFT_create()
sift = cv.SIFT()
sift = cv.xfeatures2d.SIFT()
As this usually results in errors like this: Attribute Error: module cv2 has no attribute 'SIFT_create' (same thing happens for the other 3 options), I figure that I am either using it in an incorrect way or the installation process itself did not work properly.
After this, I found the pip install opencv-contrib-python and used it. With no results at all.
I would really appreciate some hints on how I can make opencv with contrib modules work.
You may have to say cv2.xfeatures2d_SIFT or similar. the modules of OpenCV don't necessarily map to python submodules.
Since the patent on SIFT expired in 2019, OpenCV moved it back into features2d (main repo) from xfeatures2d (opencv_contrib repo). Please use the most recent 3.4.x release, or 4.x.
I was working on some motion detection python scripts using numpy and open cv on Visual Studio Code, all the imports were working correctly.
I installed the Platform IO extension for VScode as well as some python extensions (linter, intellisense..) and none of my imports work anymore (though numpy and open cv have correctly been installed, see picture).
I tried desinstalling numpy and open cv, re-installing, re-installing through anaconda, un-installing the extensions and re-booting, but nothing seems to work.
Do any of you know what I could try now?
Thanks!
Numpy module is detected but not imported:
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.
The problem is caused by CV2 and how __init__.py does the imports. Just ignore the warnings the program will work all the same, or you can do an import with an alias like:
import cv2.cv2 as cv2
If you have a warning on it press Alt+Enter to install and fix it. Now you will have the code completion and no other warnings (about that) on the project.
Switching to an older version of opencv solved this problem for me.
Apparently pycharm sometime breaks depending on the version of opencv. For me, the newest version was, 4.6.X unstalling and installing 4.5.X did the trick.
I use python 3.10 and my newest version for opencv is 4.6.0.66 ,by changing opencv version to 4.5.5.62 and with an alias: import cv2.cv2 as cv2 my problem has solved.
Import cv2 as follows:
from cv2 import cv2
I installed version 4.5.5.64 and imported with an alias.
import cv2.cv2 as cvv2
I was using Python 3.10.2288.0 and OpenCV 1.6.0.66.
I resolved the issue by rolling back the OpenCV version to 4.5.5.62.
I am trying to build the Python project openface, the project includes cv2 though I have a strong feeling this problem has nothing to do with openface and cv2 and more with me not understanding the Python development environment enough.
I am running on Mac OSX with El-Capitan, and am using Intellij but I have also tried PyCharm, which also comes from Jetbrains.
The issue is:
I have successfully compiled and installed cv2 on my machine and it is located at: /usr/local/lib/python2.7/site-packages/cv2.so
Meaning it is a shared object, but from my understanding it should still work.
I've added this so file to the Python SDK and installed it (at least I think I have).
This is a screenshot from Intellij:
And this is a screenshot from PyCharm:
And, yet, after I apply the changes:
import cv2
Is still not recognised in both Intellij and PyCharm.
How can I add this shared object to my Python project?
Many thanks in advance
I am using Tidesdk and windows7.
PIL was installed in python shown below.
C:\ProgramData\TideSDK\modules\win32\python
It works in the examination using TideSDK Developer.
If it packs, it stops however, working.
PIL is not installed if packed python is looked at.
If PIL is installed where, does it come to work?