gaur3009 commited on
Commit
1f04d42
·
verified ·
1 Parent(s): 24d82c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -26,17 +26,16 @@ def segment_dress(image):
26
  def warp_design(design, mask, warp_scale):
27
  """Warp the design using TPS and scale control."""
28
  h, w = mask.shape[:2]
29
-
30
  # Resize design to match mask dimensions
31
  design_resized = cv2.resize(design, (w, h))
32
 
 
 
 
33
  # Ensure mask is single-channel grayscale
34
  if len(mask.shape) == 3:
35
  mask = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY)
36
-
37
- # Ensure mask is uint8
38
- if mask.dtype != np.uint8:
39
- mask = (mask * 255).astype(np.uint8)
40
 
41
  # Convert design_resized to 3-channel if it's grayscale
42
  if len(design_resized.shape) == 2:
 
26
  def warp_design(design, mask, warp_scale):
27
  """Warp the design using TPS and scale control."""
28
  h, w = mask.shape[:2]
29
+
30
  # Resize design to match mask dimensions
31
  design_resized = cv2.resize(design, (w, h))
32
 
33
+ # Convert boolean mask to uint8 (0-255)
34
+ mask = (mask * 255).astype(np.uint8)
35
+
36
  # Ensure mask is single-channel grayscale
37
  if len(mask.shape) == 3:
38
  mask = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY)
 
 
 
 
39
 
40
  # Convert design_resized to 3-channel if it's grayscale
41
  if len(design_resized.shape) == 2: