gaur3009 commited on
Commit
d33a943
·
verified ·
1 Parent(s): 1a439bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -56,6 +56,10 @@ def blend_images(base, overlay, mask):
56
  if len(base.shape) == 2:
57
  base = cv2.cvtColor(base, cv2.COLOR_GRAY2BGR)
58
 
 
 
 
 
59
  # Ensure mask is single-channel grayscale
60
  if len(mask.shape) == 3:
61
  mask = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY)
 
56
  if len(base.shape) == 2:
57
  base = cv2.cvtColor(base, cv2.COLOR_GRAY2BGR)
58
 
59
+ # Convert mask to uint8 (0-255) if it's a boolean array
60
+ if mask.dtype == np.bool_:
61
+ mask = mask.astype(np.uint8) * 255
62
+
63
  # Ensure mask is single-channel grayscale
64
  if len(mask.shape) == 3:
65
  mask = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY)