|
@@ -37,6 +37,10 @@ def alpha_matting_cutout(
|
|
background_threshold: int,
|
|
background_threshold: int,
|
|
erode_structure_size: int,
|
|
erode_structure_size: int,
|
|
) -> PILImage:
|
|
) -> PILImage:
|
|
|
|
+
|
|
|
|
+ if img.mode == "RGBA" or img.mode == "CMYK":
|
|
|
|
+ img = img.convert("RGB")
|
|
|
|
+
|
|
img = np.asarray(img)
|
|
img = np.asarray(img)
|
|
mask = np.asarray(mask)
|
|
mask = np.asarray(mask)
|
|
|
|
|