Waseemali11 / Python-FYP-Face-Recognition-Attendence-System

This is the Python FYP Face Recognition Attendance System from the machine learning base By Teach Learn School.
36 stars 23 forks source link

clf=cv2.faces.LBPHFaceRecognizer_create() AttributeError: module 'cv2' has no attribute 'faces' #13

Open manaliiidixit opened 1 year ago

manaliiidixit commented 1 year ago

Facing this error and didnt find any solution.

Khayla2001 commented 1 year ago

help me please

manaliiidixit commented 1 year ago
            def face_croped(img):
                # conver gary sacle
                gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
                faces = face_classifier.detectMultiScale(gray,1.3,5)
                #Scaling factor 1.3
                # Minimum naber 5
                for (x,y,w,h) in faces:
                    face_croped=img[y:y+h,x:x+w]
                    return face_croped
            cap=cv2.VideoCapture(0)
            img_id=0
            while True:
                ret,my_frame=cap.read()
                if face_croped(my_frame) is not None:
                    img_id+=1
                    face=cv2.resize(face_croped(my_frame),(200,200))
                    face=cv2.cvtColor(face,cv2.COLOR_BGR2GRAY)

file_path="Data/stdudent."+str(id)+"."+str(img_id)+".jpg" cv2.imwrite(file_path,face)

cv2.putText(face,str(img_id),(50,50),cv2.FONT_HERSHEY_COMPLEX,2,(0,255,0),2)

                    cv2.imshow("Capture Images",face)

                if cv2.waitKey(1)==13 or int(img_id)==50:
                    break
            cap.release()
            cv2.destroyAllWindows()
            messagebox.showinfo("Result","Generating dataset

completed!",parent=self.root) except Exception as es: messagebox.showerror("Error",f"Due to: {str(es)}",parent=self.root)

try this function this will run successfully. Thank me Later

On Tue, 9 May 2023, 8:24 pm Khayla2001, @.***> wrote:

help me please

— Reply to this email directly, view it on GitHub https://github.com/Waseemali11/Python-FYP-Face-Recognition-Attendence-System/issues/13#issuecomment-1540295120, or unsubscribe https://github.com/notifications/unsubscribe-auth/A246KUIABQNXPKDKW3ERMKDXFJLCTANCNFSM6AAAAAAWL66CWQ . You are receiving this because you authored the thread.Message ID: <Waseemali11/Python-FYP-Face-Recognition-Attendence-System/issues/13/1540295120 @github.com>