OpenCV ImportError using python - opencv

I'm trying to work with OpenCV3 in Python 3.5. I installed it but when I call
import cv2
I get this error message:
ImportError: /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3: undefined
symbol:
_ZNK6google8protobuf11MessageLite25InitializationErrorStringB5cxx11Ev
Anybody ever had this error? Thanks.

Related

Error in importing ArraySliceDep from dask.layers

I got this error: ImportError: cannot import name 'ArraySliceDep' from 'dask.layers'
when I import stackstac. I have dask installed (2021.11.2 version) and my Python is 3.10 version

Expo 34: Error Undefined is not an object on _expo.Constants.deviceId

I received below message after upgrade my expo project from sdk 33 to 34. I have no idea where this issue is from. Does anyone have this error before.
install expo-constants package
change import to
import Constants from 'expo-constants';
you can use Constants.installationId and not deviceId.

Can't import plotnine

Getting an error when trying to import plotline; I pip installed Unicode, but still seeing the same error. Not sure what else I need to install.
import plotline as p9
ImportError: cannot import name 'unicode'

"'cv2.face' has no attribute 'LBPHFaceRecognizer_create'" but if installed from pip the gui gives qt thread error

I'm trying to run a python script for a basic face recognition but when running after installing from pip I get the error:
QObject::moveToThread: Current thread (0x24c8e90) is not the object's thread (0x20da6d0).
Cannot move to target thread (0x24c8e90)
I found this question and it solved the problem but after that I get this error:
Traceback (most recent call last):
File "face_recognition.py", line 21, in
recognizer = cv2.face.LBPHFaceRecognizer_create()
AttributeError: module 'cv2.face' has no attribute 'LBPHFaceRecognizer_create'
I found many answers (for example) to this problem but all suggested to install the opencv-contrib-python package from pip.
How can I include the needed package from apt-get?
The code where I get the error:
import cv2
import numpy as np
recognizer = cv2.face.LBPHFaceRecognizer_create()

Opencv Python-3.5.2 Face Recognition

I am working on Face Recognition. My code was working fine but the results were not that good so I did a little revision and along with some amendements, I updated my opencv-python from 3.4.3 to 3.4.4 and same for the opencv-contrib-python. And now I am getting syntax errors.
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
Error: cv2.error: OpenCV(3.4.4) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:181: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
And also,
cv2.face.LBPHFaceRecognizer_create()
AttributeError: module 'cv2.cv2' has no attribute 'face'
I didn't get any Errors like this before but after updating, I am getting these. What's the solution.
You can go back to the previous version and try.
pip uninstall opencv-python
pip install opencv-python==3.4.3
the same as opencv-contrib-python.
Then see if your code works.

Resources