Spaces:
Runtime error
Runtime error
Update config.py
Browse files
config.py
CHANGED
|
@@ -73,6 +73,32 @@ MAX_SPRITE_AREA_FRACTION = float(os.environ.get("MAX_SPRITE_AREA_FRACTION", "0.6
|
|
| 73 |
# Confidence below which a sprite is flagged for mandatory manual review.
|
| 74 |
LOW_CONFIDENCE_THRESHOLD = int(os.environ.get("LOW_CONFIDENCE_THRESHOLD", "70"))
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
# ---------------------------------------------------------------------------
|
| 77 |
# Background detection
|
| 78 |
# ---------------------------------------------------------------------------
|
|
|
|
| 73 |
# Confidence below which a sprite is flagged for mandatory manual review.
|
| 74 |
LOW_CONFIDENCE_THRESHOLD = int(os.environ.get("LOW_CONFIDENCE_THRESHOLD", "70"))
|
| 75 |
|
| 76 |
+
# ---------------------------------------------------------------------------
|
| 77 |
+
# Grid segmentation (portrait/expression sheets with zero gap between cells)
|
| 78 |
+
# ---------------------------------------------------------------------------
|
| 79 |
+
|
| 80 |
+
# Candidate cell sizes tried when auto-detecting a regular grid layout.
|
| 81 |
+
# Covers common pixel-art tile/portrait conventions from tiny icon grids
|
| 82 |
+
# up to full-portrait sheets (Stardew Valley portraits are 64x64).
|
| 83 |
+
GRID_CANDIDATE_SIZES = [8, 12, 16, 24, 32, 48, 64, 96, 128]
|
| 84 |
+
|
| 85 |
+
# A candidate grid is only accepted if the sheet's width and height both
|
| 86 |
+
# divide evenly by the same candidate cell size (or a cell width/height
|
| 87 |
+
# pair, for non-square cells) -- see detect_grid_layout(). This tolerance
|
| 88 |
+
# allows the sheet dimension to be off by a couple of stray padding
|
| 89 |
+
# pixels and still match (some scraped sheets have a 1-2px border).
|
| 90 |
+
GRID_DIVISION_TOLERANCE_PX = int(os.environ.get("GRID_DIVISION_TOLERANCE_PX", "2"))
|
| 91 |
+
|
| 92 |
+
# When gap-based segmentation produces this few detected regions AND at
|
| 93 |
+
# least one of them spans nearly the sheet's full height or full width,
|
| 94 |
+
# it's treated as a likely "whole row/column fused into one blob"
|
| 95 |
+
# failure and grid mode is tried as a fallback (auto mode only). Full-
|
| 96 |
+
# axis span (not just large area) is what actually distinguishes this
|
| 97 |
+
# failure from a sheet that legitimately has a couple of large,
|
| 98 |
+
# separate sprites on it.
|
| 99 |
+
GRID_FALLBACK_MAX_REGIONS = int(os.environ.get("GRID_FALLBACK_MAX_REGIONS", "6"))
|
| 100 |
+
GRID_FALLBACK_SPAN_FRACTION = float(os.environ.get("GRID_FALLBACK_SPAN_FRACTION", "0.85"))
|
| 101 |
+
|
| 102 |
# ---------------------------------------------------------------------------
|
| 103 |
# Background detection
|
| 104 |
# ---------------------------------------------------------------------------
|