Ask Your Question

Revision history [back]

python sample script error : AttributeError: module 'cv2' has no attribute 'CascadeClassifire' (OpenCV 3.1, python 3)

i am working on face recognition system here is my code detector = cv2.CascadeClassifire("C:/Users/Rahul/Desktop/OpenC/OpenCv3.1/opencv/sources/data/haarcascades/haarcascade_frontalface_alt.xml")

scale_factor = 1.2 min_neighbors = 5 min_size =(30,30) biggest_only = True flags = cv2.CASCADE_FIND_BIGGEST_OBJECT|cv2.CASCADE_DO_ROUGH_SEARCH if biggest_only else cv2.CASCADE_SCALE_IMAGE faces_coord = detector.detectMultiScale(frame,scaleFactor=scale_factor,minNeighbors=min_neighbors,minSize=min_size,flags=flags) print ("Type: " + str(type(faces_coord))) print (faces_coord) print ("Length: " + str(len(faces_coord))) for (x, y, w, h) in faces_coord : cv2.rectangle(frame,(x,y),(x+w ,y+h),(150,150,0),8) plt.show(frame)

output

AttributeError Traceback (most recent call last) <ipython-input-11-13e571300b67> in <module>() ----> 1 detector = cv2.CascadeClassifire("C:/Users/Rahul/Desktop/OpenC/OpenCv3.1/opencv/sources/data/haarcascades/haarcascade_frontalface_alt.xml") 2 3 scale_factor = 1.2 4 min_neighbors = 5 5 min_size =(30,30)

AttributeError: module 'cv2' has no attribute 'CascadeClassifire'

click to hide/show revision 2
No.2 Revision

updated 2016-12-17 05:14:11 -0600

berak gravatar image

python sample script error : AttributeError: module 'cv2' has no attribute 'CascadeClassifire' (OpenCV 3.1, python 3)

i am working on face recognition system here is my code detector = cv2.CascadeClassifire("C:/Users/Rahul/Desktop/OpenC/OpenCv3.1/opencv/sources/data/haarcascades/haarcascade_frontalface_alt.xml")code

detector = cv2.CascadeClassifire("C:/Users/Rahul/Desktop/OpenC/OpenCv3.1/opencv/sources/data/haarcascades/haarcascade_frontalface_alt.xml")

scale_factor = 1.2
min_neighbors = 5
min_size =(30,30)
biggest_only = True
flags = cv2.CASCADE_FIND_BIGGEST_OBJECT|cv2.CASCADE_DO_ROUGH_SEARCH if  biggest_only else cv2.CASCADE_SCALE_IMAGE
faces_coord = detector.detectMultiScale(frame,scaleFactor=scale_factor,minNeighbors=min_neighbors,minSize=min_size,flags=flags)
print ("Type: " + str(type(faces_coord)))
print (faces_coord)
print ("Length: " + str(len(faces_coord)))
for (x, y, w, h) in faces_coord : cv2.rectangle(frame,(x,y),(x+w ,y+h),(150,150,0),8)
plt.show(frame)plt.show(frame)

output

output

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-11-13e571300b67> in <module>()
----> 1 detector = cv2.CascadeClassifire("C:/Users/Rahul/Desktop/OpenC/OpenCv3.1/opencv/sources/data/haarcascades/haarcascade_frontalface_alt.xml")
      2 
      3 scale_factor = 1.2
      4 min_neighbors = 5
      5 min_size =(30,30)

=(30,30)

AttributeError: module 'cv2' has no attribute 'CascadeClassifire'

'CascadeClassifire'