You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi,
can you help me with this?. i was trying to set th Path with (D:\Phyton\TrainingImageLabel\Trainner.yml) but it was getting error
def TrainImages():
recognizer = cv2.face_LBPHFaceRecognizer.create()
detector=cv2.CascadeClassifier('D:\opencv\opencv\sources\data\haarcascades\haarcascade_frontalface_default.xml')
Path = r"D:\Phyton\TrainingImageLabel\Trainner.yml"
face,Id= getImagesAndLabels(Path)
recognizer.train(faces,np,array(Id))
recognizer.save("TrainingImageLabel\Trainner.yml")
res = "Image Trained"#+','.join(str(f) for f in Id)
message.configure(text=res)
def getImagesAndLabels(path):
imagePaths=[os.path.join(path,f) for f in os.listdir(path)]
faces = []
Ids = []
for imagePath in imagePaths:
pilImage=Image.open(imagePath).convert('L')
imageNp=np.array(pilImage,'uint8')
Id=int(os.path.split(imagePath)[-1].split(".")[1])
faces.append(imageNp)
Ids.append(Id)
return faces,Ids
The text was updated successfully, but these errors were encountered:
hi,
can you help me with this?. i was trying to set th Path with (D:\Phyton\TrainingImageLabel\Trainner.yml) but it was getting error
def TrainImages():
recognizer = cv2.face_LBPHFaceRecognizer.create()
detector=cv2.CascadeClassifier('D:\opencv\opencv\sources\data\haarcascades\haarcascade_frontalface_default.xml')
Path = r"D:\Phyton\TrainingImageLabel\Trainner.yml"
face,Id= getImagesAndLabels(Path)
recognizer.train(faces,np,array(Id))
recognizer.save("TrainingImageLabel\Trainner.yml")
res = "Image Trained"#+','.join(str(f) for f in Id)
message.configure(text=res)
def getImagesAndLabels(path):
imagePaths=[os.path.join(path,f) for f in os.listdir(path)]
faces = []
Ids = []
for imagePath in imagePaths:
pilImage=Image.open(imagePath).convert('L')
imageNp=np.array(pilImage,'uint8')
Id=int(os.path.split(imagePath)[-1].split(".")[1])
faces.append(imageNp)
Ids.append(Id)
return faces,Ids
The text was updated successfully, but these errors were encountered: