def model(algorithm, thresh):
# set the choosen algorithm
model = None
if is_cv3():
# OpenCV version renamed the face module
if algorithm == 1:
model = cv2.face.createLBPHFaceRecognizer(threshold=thresh)
elif algorithm == 2:
model = cv2.face.createFisherFaceRecognizer(threshold=thresh)
elif algorithm == 3:
model = cv2.face.createEigenFaceRecognizer(threshold=thresh)
else:
print("WARNING: face algorithm must be in the range 1-3")
os._exit(1)
else:
if algorithm == 1:
model = cv2.createLBPHFaceRecognizer(threshold=thresh)
elif algorithm == 2:
model = cv2.createFisherFaceRecognizer(threshold=thresh)
elif algorithm == 3:
model = cv2.createEigenFaceRecognizer(threshold=thresh)
else:
print("WARNING: face algorithm must be in the range 1-3")
os._exit(1)
return model
评论列表
文章目录