diff --git a/mainscripts/Extractor.py b/mainscripts/Extractor.py index d9fb5b6..55434d5 100644 --- a/mainscripts/Extractor.py +++ b/mainscripts/Extractor.py @@ -177,32 +177,21 @@ class ExtractSubprocessor(Subprocessor): if self.debug_dir is not None: LandmarksProcessor.draw_rect_landmarks (debug_image, rect, image_landmarks, self.image_size, self.face_type, transparent_mask=True) - - 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 copy it in order not to lose quality output_file = str(self.output_path / filename_path.name) if str(filename_path) != str(output_file): 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: output_file = '{}_{}{}'.format(str(self.output_path / filename_path.stem), str(face_idx), '.jpg') 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=landmarks, - source_filename=source_filename, - source_rect=source_rect, - source_landmarks=source_landmarks, + landmarks=face_image_landmarks.tolist(), + source_filename=filename_path.name, + source_rect=rect, + source_landmarks=image_landmarks.tolist(), image_to_face_mat=image_to_face_mat ) diff --git a/utils/DFLJPG.py b/utils/DFLJPG.py index 9e96807..efd4370 100644 --- a/utils/DFLJPG.py +++ b/utils/DFLJPG.py @@ -225,6 +225,3 @@ class DFLJPG(object): def get_source_filename(self): return self.dfl_dict['source_filename'] def get_source_rect(self): return self.dfl_dict['source_rect'] def get_source_landmarks(self): return np.array ( self.dfl_dict['source_landmarks'] ) - def get_image_to_face_mat(self): - mat = self.dfl_dict.get('image_to_face_mat', None) - return np.array(mat) if mat is not None else None \ No newline at end of file diff --git a/utils/DFLPNG.py b/utils/DFLPNG.py index 93b19bc..604e44b 100644 --- a/utils/DFLPNG.py +++ b/utils/DFLPNG.py @@ -329,9 +329,6 @@ class DFLPNG(object): def get_source_filename(self): return self.fcwp_dict['source_filename'] def get_source_rect(self): return self.fcwp_dict['source_rect'] def get_source_landmarks(self): return np.array ( self.fcwp_dict['source_landmarks'] ) - def get_image_to_face_mat(self): - mat = self.fcwp_dict.get('image_to_face_mat', None) - return np.array(mat) if mat is not None else None def __str__(self): return "".format(len(self.chunks), **self.__dict__)