Spaces:
Sleeping
Sleeping
Update faceless_processing.py
Browse files- faceless_processing.py +5 -3
faceless_processing.py
CHANGED
|
@@ -136,10 +136,10 @@ class LineartConfig:
|
|
| 136 |
lineart_detect_resolution: int = 1024
|
| 137 |
lineart_image_resolution: int = 1024
|
| 138 |
lineart_coarse: bool = True
|
| 139 |
-
lineart_threshold: int =
|
| 140 |
|
| 141 |
# AJUSTE DE CABELO E CORPO: Diminu铆do para capturar fios e dobras de roupa.
|
| 142 |
-
lineart_min_perimeter: float =
|
| 143 |
|
| 144 |
# Diminu铆do para manter os tra莽os mais pr贸ximos da borda.
|
| 145 |
interior_erode_size: int = 1
|
|
@@ -400,8 +400,10 @@ def build_interior_edges(rgb: np.ndarray, subject_mask: np.ndarray, cfg: Lineart
|
|
| 400 |
cv2.drawContours(filtered, [cnt], -1, 255, cfg.interior_line_thickness)
|
| 401 |
|
| 402 |
# Gentle dilation for solid, embroiderable strokes
|
| 403 |
-
|
| 404 |
filtered = cv2.dilate(filtered, kernel_dilate, iterations=1)
|
|
|
|
|
|
|
| 405 |
return filtered
|
| 406 |
except Exception as e:
|
| 407 |
print(f"[AI] Neural lineart failed, falling back to Canny: {e}")
|
|
|
|
| 136 |
lineart_detect_resolution: int = 1024
|
| 137 |
lineart_image_resolution: int = 1024
|
| 138 |
lineart_coarse: bool = True
|
| 139 |
+
lineart_threshold: int = 75
|
| 140 |
|
| 141 |
# AJUSTE DE CABELO E CORPO: Diminu铆do para capturar fios e dobras de roupa.
|
| 142 |
+
lineart_min_perimeter: float = 26.0
|
| 143 |
|
| 144 |
# Diminu铆do para manter os tra莽os mais pr贸ximos da borda.
|
| 145 |
interior_erode_size: int = 1
|
|
|
|
| 400 |
cv2.drawContours(filtered, [cnt], -1, 255, cfg.interior_line_thickness)
|
| 401 |
|
| 402 |
# Gentle dilation for solid, embroiderable strokes
|
| 403 |
+
ernel_dilate = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (3, 3))
|
| 404 |
filtered = cv2.dilate(filtered, kernel_dilate, iterations=1)
|
| 405 |
+
filtered = cv2.GaussianBlur(filtered, (3, 3), 0)
|
| 406 |
+
filtered = cv2.threshold(filtered, 127, 255, cv2.THRESH_BINARY)
|
| 407 |
return filtered
|
| 408 |
except Exception as e:
|
| 409 |
print(f"[AI] Neural lineart failed, falling back to Canny: {e}")
|