def move(path, get_user_id, dirpath): old_json_path = path json_results_source_wholepath = dirpath + "\\" + get_user_id + "\\" + "Results.json" belonger, belonger_sub_face_name = get_JsonResultsSource_Belonger(json_results_source_wholepath) if belonger != -1: new_path, account_lib, extracted_lib = create_libs(get_user_id) # <Attention>: 下面指令筛选出了主人的脸中相对最大的那张脸 size, belonger, belongerFace_JPG_Wholepath = get_theMaxPic(belonger, belonger_sub_face_name, dirpath, get_user_id) if (size[0] < 48) | (size[1] < 48): ResizeImage(belongerFace_JPG_Wholepath, belongerFace_JPG_Wholepath, 80, 80) copy(belongerFace_JPG_Wholepath, extracted_lib)
def getScoreWholeProcess(belonger, belonger_sub_face_name, dirpath, get_user_id): # <Attention>: 下面指令筛选出了主人的脸中相对最大的那张脸 size, belonger, belongerFace_JPG_Wholepath = get_theMaxPic(belonger, belonger_sub_face_name, dirpath, get_user_id) if (size[0] < 48) | (size[1] < 48): ResizeImage(belongerFace_JPG_Wholepath, belongerFace_JPG_Wholepath, 80, 80) response = Get_TheFaceScore(belongerFace_JPG_Wholepath) req_con = response.content.decode('utf-8') req_dict = JSONDecoder().decode(req_con) print(req_dict) json_FaceScore_TheWholePath = dirpath + "\\" + get_user_id + "\\" + "Face_Scores.json" f1 = open_Json_File_To_Write(json_FaceScore_TheWholePath) write_Score(req_dict, f1, belonger)
path = path.decode('utf-8') for dirpath, dirnames, filenames in os.walk(path): for filepath in filenames: str1 = "json" str2 = "results" if str1 in filepath: if str2 in filepath: json_results_source_wholepath = dirpath + "\\" + filepath # <Sample>: # <Sample>: u'D:\\用户的文件\\广东省\\广州市\\18811860\\18811860_results.json' belonger, belonger_sub_face = get_JsonResultsSource_Belonger(json_results_source_wholepath) # 注意 : 这两个变量是一个list for belonger_i in range(0, len(belonger)) : # <Sample>: belonger = <type 'list'>: [u'011f0bd4jw1ek0s5x0uysj20qo0zkwn2_extraction_1', u'011f0bd4jw1ekdf0acjsmj218g0xcduc_extraction_1'] belongerFace_JPG_Wholepath = dirpath + "\\" + belonger[belonger_i] + "\\" + belonger_sub_face[belonger_i] + ".jpg" # <Samples>: dirpath = u'D:\\用户的文件\\广东省\\广州市\\18811860' size = Calculate_JPGsize(belongerFace_JPG_Wholepath) if (size[0] < 48) | (size[1] < 48) : ResizeImage(belongerFace_JPG_Wholepath, belongerFace_JPG_Wholepath, 80, 80) response = Get_TheFaceScore(belongerFace_JPG_Wholepath) json_FaceScore_TheWholePath = dirpath + "\\" + belonger[belonger_i] + "\\" + "Face_Score.json" f1 = open_Json_File_To_Write(json_FaceScore_TheWholePath) write_Score(response, f1, belonger[belonger_i])