Several opencv problem and the resolve:
_____
- Problem:
on centos
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
- Resolve:
yum install mesa-libGL
_____
- Problem:
cannot start Anaconda environment in windows
- Resolve:
C:\Users\webiot>D:/Anaconda/Scripts/activate
_____
- Problem:
cv2.error: OpenCV(3.4.17) D:\a....\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:383: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
- Resolve:
camera=cv2.VideoCapture(0) #check for input device, maybe 0 or 1 etc.
_____
- Problem:
recognizer = cv2.face.LBPHFaceRecognizer_create(); #create a recognizer, LBPH is a face recognition algorithm.Local Binary Patterns Histograms
AttributeError: module 'cv2' has no attribute 'face'
- Resolve:
pip uninstall opencv-contrib-python
and install again:
pip install opencv-contrib-python
_____
- Problem:
faces=detector.detectMultiScale(frame,1.1,7)
cv2.error: OpenCV(3.4.17) D:\a\opencv-python\opencv-python\opencv\modules\objdetect\src\cascadedetect.cpp:1729: error: (-215:Assertion failed) !empty() in function 'cv::CascadeClassifier::detectMultiScale'
- Resolve:
run python as your path in the code
_____
- Problem:
sqlite3.OperationalError: no such column:
- Resolve:
check your parameter and add the value with single Quote each.
_____
- Problem:
sqlite3.OperationalError: database is locked
- Resolve:
close all opened db browser
_____
- Problem:
CvCapture_MSMF::grabFrame videoio(MSMF): can't grab frame. Error: -2147483638
- Resolve:
downgrade your opencv-python with:
(base) C:\Users\webiot>pip uninstall opencv-python
(base) C:\Users\webiot>pip install opencv-python==3.4.17.63
(base) C:\Users\webiot>pip install opencv-contrib-python==3.4.17.63
_____
ANATHOR PROBLEM IN PYTHON
- Problem:
ModuleNotFoundError: No module named 'mysql.connector'; 'mysql' is not a package
- Resolve:
if you have install the mysql connector by: pip install mysql-connector-python
You make sure or rename your py file not as mysql.py
_____
- Problem:
Redirect has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header
- Resolve:
Add this extension on chrome browser:
Allow CORS: Access-Control-Allow-Origin
_____
- Problem:
python flask not reading image from ajax POST request form
- Resolve:
make sure that params use encodeURIComponent(uri):
ex:
client side
var tes = canvas.toDataURL("image/jpeg");
params = "baseku="+encodeURIComponent(tes);
xmlhttp.send(params);
server side
@app.route('/img', methods=['POST'])
def img():
if 'baseku' in request.form:
photo_base64 = request.form['baseku']
return jsonify(response=photo_base64)
_____