Spaces:
Running
Running
devendergarg14
commited on
Commit
•
707a025
1
Parent(s):
ae983b9
Update SegCloth.py
Browse files- SegCloth.py +3 -0
SegCloth.py
CHANGED
@@ -34,6 +34,9 @@ def segment_clothing(img, clothes=["Hat", "Upper-clothes", "Skirt", "Pants", "Dr
|
|
34 |
contours, _ = cv2.findContours(final_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
35 |
cv2.drawContours(final_mask, contours, -1, (255), thickness=cv2.FILLED)
|
36 |
|
|
|
|
|
|
|
37 |
# Convert mask to binary (0 or 255) if needed for alpha channel
|
38 |
_, final_mask = cv2.threshold(final_mask, 127, 255, cv2.THRESH_BINARY)
|
39 |
|
|
|
34 |
contours, _ = cv2.findContours(final_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
35 |
cv2.drawContours(final_mask, contours, -1, (255), thickness=cv2.FILLED)
|
36 |
|
37 |
+
# Apply Gaussian blur to smooth edges and reduce noise
|
38 |
+
final_mask = cv2.GaussianBlur(final_mask, (7, 7), 0)
|
39 |
+
|
40 |
# Convert mask to binary (0 or 255) if needed for alpha channel
|
41 |
_, final_mask = cv2.threshold(final_mask, 127, 255, cv2.THRESH_BINARY)
|
42 |
|