diff --git a/roop/ProcessMgr.py b/roop/ProcessMgr.py index 603497ef9..1ce6b8930 100644 --- a/roop/ProcessMgr.py +++ b/roop/ProcessMgr.py @@ -115,8 +115,8 @@ def initialize(self, input_faces, target_faces, options): print(f"Not using {module}") - if self.options.imagemask is not None and "layers" in self.options.imagemask and len(self.options.imagemask["layers"]) > 0: - self.options.imagemask = self.options.imagemask["layers"][0] + if isinstance(self.options.imagemask, dict) and self.options.imagemask.get("layers") and len(self.options.imagemask["layers"]) > 0: + self.options.imagemask = self.options.imagemask.get("layers")[0] # Get rid of alpha self.options.imagemask = cv2.cvtColor(self.options.imagemask, cv2.COLOR_RGBA2GRAY) if np.any(self.options.imagemask): @@ -124,8 +124,6 @@ def initialize(self, input_faces, target_faces, options): self.options.imagemask = self.blur_area(self.options.imagemask, mo[4], mo[5]) self.options.imagemask = self.options.imagemask.astype(np.float32) / 255 self.options.imagemask = cv2.cvtColor(self.options.imagemask, cv2.COLOR_GRAY2RGB) - #mask_blur = 5 - #self.options.imagemask = cv2.GaussianBlur(self.options.imagemask, (mask_blur*2+1,mask_blur*2+1), 0) else: self.options.imagemask = None @@ -154,7 +152,7 @@ def process_frames(self, source_files: List[str], target_files: List[str], curre return # Decode the byte array into an OpenCV image - temp_frame = cv2.imdecode(np.fromfile(f, dtype=np.uint8), cv2.IMREAD_UNCHANGED) + temp_frame = cv2.imdecode(np.fromfile(f, dtype=np.uint8), cv2.IMREAD_COLOR) if temp_frame is not None: resimg = self.process_frame(temp_frame) if resimg is not None: diff --git a/roop/capturer.py b/roop/capturer.py index 5a5d65c9a..6da3ac082 100644 --- a/roop/capturer.py +++ b/roop/capturer.py @@ -6,7 +6,7 @@ def get_image_frame(filename: str): try: - return cv2.imdecode(np.fromfile(filename, dtype=np.uint8), cv2.IMREAD_UNCHANGED) + return cv2.imdecode(np.fromfile(filename, dtype=np.uint8), cv2.IMREAD_COLOR) except: print(f"Exception reading {filename}") return None diff --git a/roop/face_util.py b/roop/face_util.py index 7776d038e..857cb4a8f 100644 --- a/roop/face_util.py +++ b/roop/face_util.py @@ -71,7 +71,7 @@ def extract_face_images(source_filename, video_info, extra_padding=-1.0): else: return face_data else: - source_image = cv2.imdecode(np.fromfile(source_filename, dtype=np.uint8), cv2.IMREAD_UNCHANGED) + source_image = cv2.imdecode(np.fromfile(source_filename, dtype=np.uint8), cv2.IMREAD_COLOR) faces = get_all_faces(source_image) if faces is None: diff --git a/roop/metadata.py b/roop/metadata.py index 90b6c0190..fcc1ad0d5 100644 --- a/roop/metadata.py +++ b/roop/metadata.py @@ -1,2 +1,2 @@ name = 'roop unleashed' -version = '3.6.6' +version = '3.6.7'