Skip to content

Commit

Permalink
Support for reading from UTF-8 paths/filenames using numpy instead of…
Browse files Browse the repository at this point in the history
… OpenCV which surprisingly doesn't support it.
  • Loading branch information
C0untFloyd committed Mar 30, 2024
1 parent c2931cf commit fde807a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion roop/ProcessMgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ def process_frames(self, source_files: List[str], target_files: List[str], curre
if not roop.globals.processing:
return

temp_frame = cv2.imread(f)
# Decode the byte array into an OpenCV image
temp_frame = cv2.imdecode(np.fromfile(f, dtype=np.uint8), cv2.IMREAD_UNCHANGED)
if temp_frame is not None:
resimg = self.process_frame(temp_frame)
if resimg is not None:
Expand Down
4 changes: 2 additions & 2 deletions roop/capturer.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import Optional
import cv2
import numpy as np

from roop.typing import Frame

def get_image_frame(filename: str):
try:
frame = cv2.imread(filename)
return frame
return cv2.imdecode(np.fromfile(filename, dtype=np.uint8), cv2.IMREAD_UNCHANGED)
except:
print(f"Exception reading {filename}")
return None
Expand Down
2 changes: 1 addition & 1 deletion roop/face_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def extract_face_images(source_filename, video_info, extra_padding=-1.0):
else:
return face_data
else:
source_image = cv2.imread(source_filename)
source_image = cv2.imdecode(np.fromfile(source_filename, dtype=np.uint8), cv2.IMREAD_UNCHANGED)

faces = get_all_faces(source_image)
if faces is None:
Expand Down
2 changes: 1 addition & 1 deletion roop/metadata.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name = 'roop unleashed'
version = '3.6.5'
version = '3.6.6'

0 comments on commit fde807a

Please sign in to comment.