Apex-X commited on
Commit
10ccc3b
·
verified ·
1 Parent(s): 5e8d609

Update roop/processors/frame/face_swapper.py

Browse files
roop/processors/frame/face_swapper.py CHANGED
@@ -80,9 +80,14 @@ def process_frames(source_path: str, temp_frame_paths: List[str], update: Callab
80
  def process_image(source_path: str, target_path: str, output_path: str) -> None:
81
  source_face = get_one_face(cv2.imread(source_path))
82
  target_frame = cv2.imread(target_path)
83
- result = process_frame(source_face, target_frame)
 
84
  cv2.imwrite(output_path, result)
85
 
86
 
87
  def process_video(source_path: str, temp_frame_paths: List[str]) -> None:
 
 
 
 
88
  roop.processors.frame.core.process_video(source_path, temp_frame_paths, process_frames)
 
80
  def process_image(source_path: str, target_path: str, output_path: str) -> None:
81
  source_face = get_one_face(cv2.imread(source_path))
82
  target_frame = cv2.imread(target_path)
83
+ reference_face = None if roop.globals.many_faces else get_one_face(target_frame, roop.globals.reference_face_position)
84
+ result = process_frame(source_face, reference_face, target_frame)
85
  cv2.imwrite(output_path, result)
86
 
87
 
88
  def process_video(source_path: str, temp_frame_paths: List[str]) -> None:
89
+ if not roop.globals.many_faces and not get_face_reference():
90
+ reference_frame = cv2.imread(temp_frame_paths[roop.globals.reference_frame_number])
91
+ reference_face = get_one_face(reference_frame, roop.globals.reference_face_position)
92
+ set_face_reference(reference_face)
93
  roop.processors.frame.core.process_video(source_path, temp_frame_paths, process_frames)