mirror of
https://github.com/s0md3v/roop.git
synced 2025-12-06 18:08:29 +00:00
issue #511
Avoiding of opencv unicode paths bug in face_enhancer methods
This commit is contained in:
parent
e9e7e0c080
commit
8e1d29218e
@ -2,6 +2,7 @@ from typing import Any, List
|
||||
import cv2
|
||||
import threading
|
||||
import gfpgan
|
||||
import numpy
|
||||
|
||||
import roop.globals
|
||||
import roop.processors.frame.core
|
||||
@ -57,17 +58,19 @@ def process_frame(source_face: Any, temp_frame: Any) -> Any:
|
||||
|
||||
def process_frames(source_path: str, temp_frame_paths: List[str], progress=None) -> None:
|
||||
for temp_frame_path in temp_frame_paths:
|
||||
temp_frame = cv2.imread(temp_frame_path)
|
||||
temp_frame = cv2.imdecode(numpy.fromfile(temp_frame_path, dtype=numpy.uint8), cv2.IMREAD_UNCHANGED)
|
||||
result = process_frame(None, temp_frame)
|
||||
cv2.imwrite(temp_frame_path, result)
|
||||
is_success, im_buf_arr = cv2.imencode(".png", result)
|
||||
im_buf_arr.tofile(temp_frame_path)
|
||||
if progress:
|
||||
progress.update(1)
|
||||
|
||||
|
||||
def process_image(source_path: str, target_path: str, output_path: str) -> None:
|
||||
target_frame = cv2.imread(target_path)
|
||||
target_frame = cv2.imdecode(numpy.fromfile(target_path, dtype=numpy.uint8), cv2.IMREAD_UNCHANGED)
|
||||
result = process_frame(None, target_frame)
|
||||
cv2.imwrite(output_path, result)
|
||||
is_success, im_buf_arr = cv2.imencode(".png", result)
|
||||
im_buf_arr.tofile(output_path)
|
||||
|
||||
|
||||
def process_video(source_path: str, temp_frame_paths: List[str]) -> None:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user