Spaces:
Running
Running
Update SegCloth.py
Browse files- SegCloth.py +3 -3
SegCloth.py
CHANGED
@@ -24,11 +24,11 @@ def segment_clothing(img, clothes=["Hat", "Upper-clothes", "Skirt", "Pants", "Dr
|
|
24 |
final_mask = np.maximum(final_mask, mask)
|
25 |
|
26 |
# Optional: Dilate the mask to ensure coverage at edges
|
27 |
-
kernel = np.ones((5, 5), np.uint8)
|
28 |
-
final_mask = cv2.dilate(final_mask, kernel, iterations=2)
|
29 |
|
30 |
# Optional: Erode to slightly smoothen the mask
|
31 |
-
final_mask = cv2.erode(final_mask, kernel, iterations=1)
|
32 |
|
33 |
# Optional: Use contour filling to ensure all areas within contours are filled
|
34 |
contours, _ = cv2.findContours(final_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
|
|
24 |
final_mask = np.maximum(final_mask, mask)
|
25 |
|
26 |
# Optional: Dilate the mask to ensure coverage at edges
|
27 |
+
#kernel = np.ones((5, 5), np.uint8)
|
28 |
+
#final_mask = cv2.dilate(final_mask, kernel, iterations=2)
|
29 |
|
30 |
# Optional: Erode to slightly smoothen the mask
|
31 |
+
#final_mask = cv2.erode(final_mask, kernel, iterations=1)
|
32 |
|
33 |
# Optional: Use contour filling to ensure all areas within contours are filled
|
34 |
contours, _ = cv2.findContours(final_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|