Closed Mayoogh closed 4 years ago
Possibly failed to load the webcam properly. Check in your cv2.imread line if the webcam exist and does not return a None. Also check the count variable if it has a valid number.
Also, the detector.py in detectMultiScale inputs a flags parameter. This parameter is only used by old format cascade, removing the parameter might help you resolve your error.
faces = detector.detectMultiScale(gray, scaleFactor=1.2, minNeighbors=5, minSize=(100, 100))
flags – Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
https://docs.opencv.org/2.4/modules/objdetect/doc/cascade_classification.html
opencv version 4.0.0 Python version 3.5.2
File "detector.py", line 18, in
gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.0.0) /io/opencv/modules/imgproc/src/color.cpp:181: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'