(-2:Unspecified error) OPENCV (4.4.0) ERROR

Question:

I’m getting an error (shown below) when I run my program. Does anybody know how to solve it?

#Display the resulting frame
cv2.imshow('frame',frame)

if cv2.waitKey(1) & 0xFF == ord('q'):
    break

#When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

I am getting this error.How can I fix it?

Asked By: ms.bigdatax

||

Answers:

Uninstall the others as before:

  1. pip3 uninstall opencv-python
  2. pip3 uninstall opencv-contrib-python
  3. pip3 uninstall opencv-contrib-python-headless

And then only install the first two:

  1. pip3 install opencv-python==4.4.0.46
  2. pip3 install opencv-contrib-python==4.4.0.46

This may further help you: OpenCV "The function is not implemented. Rebuild the library with Windows"

Answered By: TerminalFlow

I had the same error. Reinstalling opencv-python doesn’t solve anything.

Found out that two files are missing from the folder:

  • age_net.caffemodel
    Missing file
  • gender_net.caffemodel
    Missing file

Adding both files in the project folder solves the issue.

Answered By: Ravin Sanchez
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.