I am getting the below error, when i am running my code.
Please help me on this.
error:
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/core/src/array.cpp, line 2482
Traceback (most recent call last):
File “/home/rajat/.config/gedit/tools/new-tool”, line 12, in
exec(sys.stdin.read())
File “”, line 85, in
File “”, line 60, in predict
cv2.error: /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/core/src/array.cpp:2482: error: (-206) Unrecognized or unsupported array type in function cvGetMat
code:
video_cap = cv2.VideoCapture(0)
while True:
ret, frame = video_cap.read()
frame = cv2.resize(frame, (0,0), fx=0.5, fy=0.5)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.05, 6)
for face in faces:
x, y, w, h = face
face_region = gray[y:y+h, x:x+w]
predicted_person_number, confidence = face_recognition.predict(face_region)
cv2.rectangle(frame, (x,y), (x+w,y+h), (0,255,0), 2)
if predicted_person_number == 16:
cv2.putText(frame, 'RB', (x,y), cv2.FONT_HERSHEY_TRIPLEX, 1, (255,255,255))
else:
cv2.putText(frame, str(predicted_person_number), (x,y), cv2.FONT_HERSHEY_TRIPLEX, 1, (255,255,255))
cv2.imshow('Running face recognition...', frame)
if cv2.waitKey(1) & 0xFF == ord('q'): break
video_cap.release()
cv2.destroyAllWindows()
Hello,
I am getting the below error, when i am running my code. Please help me on this.
error:
code: