fix
This commit is contained in:
@@ -142,6 +142,14 @@ class ExtractSubprocessor(Subprocessor):
|
||||
debug_output_file = str( Path(self.debug_dir) / (filename_path.stem+'.jpg') )
|
||||
debug_image = image.copy()
|
||||
|
||||
if src_dflimg is not None and len(faces) != 1:
|
||||
#if re-extracting from dflimg and more than 1 or zero faces detected - dont process and just copy it
|
||||
print("src_dflimg is not None and len(faces) != 1", str(filename_path) )
|
||||
output_file = str(self.output_path / filename_path.name)
|
||||
if str(filename_path) != str(output_file):
|
||||
shutil.copy ( str(filename_path), str(output_file) )
|
||||
result.append (output_file)
|
||||
else:
|
||||
face_idx = 0
|
||||
for face in faces:
|
||||
rect = np.array(face[0])
|
||||
@@ -169,9 +177,6 @@ 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)
|
||||
|
||||
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()
|
||||
@@ -189,6 +194,7 @@ class ExtractSubprocessor(Subprocessor):
|
||||
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),
|
||||
@@ -200,6 +206,7 @@ class ExtractSubprocessor(Subprocessor):
|
||||
)
|
||||
|
||||
result.append (output_file)
|
||||
face_idx += 1
|
||||
|
||||
if self.debug_dir is not None:
|
||||
cv2_imwrite(debug_output_file, debug_image, [int(cv2.IMWRITE_JPEG_QUALITY), 50] )
|
||||
|
||||
Reference in New Issue
Block a user