Ask Your Question

Rahul9762's profile - activity

2020-07-27 03:03:50 -0600 received badge  Popular Question (source)
2016-12-17 05:07:07 -0600 asked a question 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'