mirror of
https://github.com/s0md3v/roop.git
synced 2025-12-16 03:27:19 +00:00
Move reference creation to process_video
This commit is contained in:
parent
d59c55dc02
commit
7529ba6708
@ -75,12 +75,7 @@ def process_frame(source_face: Face, reference_face: Face, temp_frame: Frame) ->
|
|||||||
|
|
||||||
def process_frames(source_path: str, temp_frame_paths: List[str], update: Callable[[], None]) -> None:
|
def process_frames(source_path: str, temp_frame_paths: List[str], update: Callable[[], None]) -> None:
|
||||||
source_face = get_one_face(cv2.imread(source_path))
|
source_face = get_one_face(cv2.imread(source_path))
|
||||||
if not get_face_reference():
|
reference_face = get_face_reference()
|
||||||
reference_frame = cv2.imread(temp_frame_paths[roop.globals.reference_frame_number])
|
|
||||||
reference_face = get_one_face(reference_frame, roop.globals.reference_face_position)
|
|
||||||
set_face_reference(reference_face)
|
|
||||||
else:
|
|
||||||
reference_face = get_face_reference()
|
|
||||||
for temp_frame_path in temp_frame_paths:
|
for temp_frame_path in temp_frame_paths:
|
||||||
temp_frame = cv2.imread(temp_frame_path)
|
temp_frame = cv2.imread(temp_frame_path)
|
||||||
result = process_frame(source_face, reference_face, temp_frame)
|
result = process_frame(source_face, reference_face, temp_frame)
|
||||||
@ -98,4 +93,7 @@ def process_image(source_path: str, target_path: str, output_path: str) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def process_video(source_path: str, temp_frame_paths: List[str]) -> None:
|
def process_video(source_path: str, temp_frame_paths: List[str]) -> None:
|
||||||
|
reference_frame = cv2.imread(temp_frame_paths[roop.globals.reference_frame_number])
|
||||||
|
reference_face = get_one_face(reference_frame, roop.globals.reference_face_position)
|
||||||
|
set_face_reference(reference_face)
|
||||||
roop.processors.frame.core.process_video(source_path, temp_frame_paths, process_frames)
|
roop.processors.frame.core.process_video(source_path, temp_frame_paths, process_frames)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user