@@ -34,7 +34,7 @@ def compare_face(known_path, video_path, request_upload_folder_path, request_fra
3434 is_match = None
3535 confidences_list = []
3636 known_face_encoding = []
37- sharpness_difference = None
37+ sharpness_similarity = None
3838
3939 # Load the uploaded image file
4040 known_image = face_recognition .load_image_file (known_path )
@@ -55,7 +55,7 @@ def compare_face(known_path, video_path, request_upload_folder_path, request_fra
5555 face_image = known_image [top :bottom , left :right ]
5656 cropped_face = Image .fromarray (face_image )
5757 cropped_face .save (cropped_face_path , "JPEG" )
58- sharpness_difference = calculate_sharpness (known_path , cropped_face_path )
58+ sharpness_similarity = calculate_sharpness (known_path , cropped_face_path )
5959
6060 #####
6161 # Part 2
@@ -108,7 +108,7 @@ def compare_face(known_path, video_path, request_upload_folder_path, request_fra
108108 print ("Did not found face in either image or video. Can't proceed to compare with image" )
109109 delete_files (request_upload_folder_path , request_frames_folder_path )
110110 return jsonify (get_json_response (face_found_in_image , face_found_in_video , is_match , final_confidence ,
111- sharpness_difference , file_type , ocr_results ))
111+ sharpness_similarity , file_type , ocr_results ))
112112
113113 #####
114114 # Part 4
@@ -117,7 +117,7 @@ def compare_face(known_path, video_path, request_upload_folder_path, request_fra
117117 # and return the result as Json
118118 #####
119119 final_confidence = sum (confidences_list ) / float (len (confidences_list ))
120- if final_confidence >= face_match_threshold and sharpness_difference > sharpness_threshold :
120+ if final_confidence >= face_match_threshold and sharpness_similarity > sharpness_threshold :
121121 is_match = True
122122 else :
123123 is_match = False
@@ -131,18 +131,18 @@ def compare_face(known_path, video_path, request_upload_folder_path, request_fra
131131 delete_files (request_upload_folder_path , request_frames_folder_path )
132132
133133 return jsonify (
134- get_json_response (face_found_in_image , face_found_in_video , is_match , final_confidence , sharpness_difference ,
134+ get_json_response (face_found_in_image , face_found_in_video , is_match , final_confidence , sharpness_similarity ,
135135 file_type , ocr_results ))
136136
137137
138- def get_json_response (face_found_in_image , face_found_in_video , is_match , final_confidence , sharpness_difference ,
138+ def get_json_response (face_found_in_image , face_found_in_video , is_match , final_confidence , sharpness_similarity ,
139139 file_type , ocr_results ):
140140 return {
141141 "face_found_in_image" : face_found_in_image ,
142142 "face_found_in_video" : face_found_in_video ,
143143 "is_match" : is_match ,
144144 "confidence" : final_confidence ,
145- "sharpness_difference " : sharpness_difference ,
145+ "sharpness_similarity " : sharpness_similarity ,
146146 "file_type" : file_type ,
147147 "ocr_results" : ocr_results
148148 }
0 commit comments