diff --git a/mainscripts/Extractor.py b/mainscripts/Extractor.py index 8fdf7e7..47cf25e 100644 --- a/mainscripts/Extractor.py +++ b/mainscripts/Extractor.py @@ -163,17 +163,30 @@ class ExtractSubprocessor(Subprocessor): output_file = '{}_{}{}'.format(str(self.output_path / filename_path.stem), str(face_idx), '.jpg') face_idx += 1 + landmarks=face_image_landmarks.tolist() + source_filename = filename_path.name + source_landmarks = image_landmarks.tolist() + source_rect = rect if src_dflimg is not None: - #if extracting from dflimg just copy it in order not to lose quality + #if extracting from dflimg copy it in order not to lose quality + output_file = str(self.output_path / filename_path.name) shutil.copy ( str(filename_path), str(output_file) ) + + #and transfer data + source_filename = src_dflimg.get_source_filename() + mat = src_dflimg.get_image_to_face_mat() + if mat is not None: + image_to_face_mat = mat + source_landmarks = LandmarksProcessor.transform_points (landmarks, image_to_face_mat, True) else: cv2_imwrite(output_file, face_image, [int(cv2.IMWRITE_JPEG_QUALITY), 85] ) - DFLJPG.embed_data(output_file, face_type = FaceType.toString(self.face_type), - landmarks = face_image_landmarks.tolist(), - source_filename = filename_path.name, - source_rect= rect, - source_landmarks = image_landmarks.tolist() + DFLJPG.embed_data(output_file, face_type=FaceType.toString(self.face_type), + landmarks=landmarks, + source_filename=source_filename, + source_rect=source_rect, + source_landmarks=source_landmarks, + image_to_face_mat=image_to_face_mat ) result.append (output_file)