'cv2.cascadeclassifier' Object Has No Attribute 'detectmultiscale'
I simply want to detect face and eyes using haarcascade. But this is the error I am receiving. Traceback (most recent call last): File 'L:/Project/1', line 10, in
Solution 1:
As @roganjosh mentioned in the comments for the question, the problem here is that the method name is not spelled out correctly. The correct function call is:
face_cascade.detectMultiScale(...)
With the difference being that the 'S' in scale is capitalized.
Solution 2:
A similar code worked for me with the absolute path for both the XML files. The sample is covered below.
1. Download XML files from [https://github.com/opencv/opencv/tree/master/data/haarcascades]
2. Mention the absolute path for the XML files (example below)
face_cascade = cv2.CascadeClassifier('C:\Python\haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('C:\Python\haarcascade_eye.xml')
Post a Comment for "'cv2.cascadeclassifier' Object Has No Attribute 'detectmultiscale'"