Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -83,14 +83,15 @@ def extract_snow_data_from_chart(image):
|
|
83 |
# Dark green (current season): deeper, more saturated green
|
84 |
# Light green (previous season): lighter, less saturated green
|
85 |
|
86 |
-
# Dark green mask (current season) -
|
87 |
-
|
88 |
-
|
|
|
89 |
dark_green_mask = cv2.inRange(hsv, dark_green_lower, dark_green_upper)
|
90 |
|
91 |
-
# Light green mask (previous season) -
|
92 |
-
light_green_lower = np.array([
|
93 |
-
light_green_upper = np.array([
|
94 |
light_green_mask = cv2.inRange(hsv, light_green_lower, light_green_upper)
|
95 |
|
96 |
# 3. Extract data points along chart width for both seasons
|
@@ -240,10 +241,14 @@ def extract_snow_data_from_chart(image):
|
|
240 |
- **Chart boundaries**: {chart_bounds}
|
241 |
- **Dark green pixels found**: {np.sum(dark_green_mask)} pixels
|
242 |
- **Light green pixels found**: {np.sum(light_green_mask)} pixels
|
243 |
-
- **Color detection**: HSV
|
|
|
|
|
244 |
|
245 |
**⚠️ Important Notes:**
|
246 |
-
- Green line detection
|
|
|
|
|
247 |
- Estimated snow season: May-November
|
248 |
- Y-axis scale assumed: 0-350cm
|
249 |
- Accuracy depends on chart image quality and color consistency
|
|
|
83 |
# Dark green (current season): deeper, more saturated green
|
84 |
# Light green (previous season): lighter, less saturated green
|
85 |
|
86 |
+
# Dark green mask (current season) - Tuned for the specific dark green color shown
|
87 |
+
# This green appears to be in the 60-80 hue range with high saturation
|
88 |
+
dark_green_lower = np.array([55, 150, 80]) # More specific range for the dark green shown
|
89 |
+
dark_green_upper = np.array([75, 255, 200]) # Narrower hue range, higher saturation
|
90 |
dark_green_mask = cv2.inRange(hsv, dark_green_lower, dark_green_upper)
|
91 |
|
92 |
+
# Light green mask (previous season) - Lighter, less saturated version
|
93 |
+
light_green_lower = np.array([50, 60, 150]) # Broader hue, lower saturation for light green
|
94 |
+
light_green_upper = np.array([80, 180, 255]) # Higher brightness for lighter green
|
95 |
light_green_mask = cv2.inRange(hsv, light_green_lower, light_green_upper)
|
96 |
|
97 |
# 3. Extract data points along chart width for both seasons
|
|
|
241 |
- **Chart boundaries**: {chart_bounds}
|
242 |
- **Dark green pixels found**: {np.sum(dark_green_mask)} pixels
|
243 |
- **Light green pixels found**: {np.sum(light_green_mask)} pixels
|
244 |
+
- **Color detection**: HSV analysis calibrated to NIWA chart colors
|
245 |
+
- **Current season detection**: Tuned for specific dark green (HSV: 55-75, 150-255, 80-200)
|
246 |
+
- **Previous season detection**: Tuned for light green (HSV: 50-80, 60-180, 150-255)
|
247 |
|
248 |
**⚠️ Important Notes:**
|
249 |
+
- Green line detection tuned to specific NIWA chart colors
|
250 |
+
- Dark green HSV range: [55-75, 150-255, 80-200] (current season)
|
251 |
+
- Light green HSV range: [50-80, 60-180, 150-255] (previous season)
|
252 |
- Estimated snow season: May-November
|
253 |
- Y-axis scale assumed: 0-350cm
|
254 |
- Accuracy depends on chart image quality and color consistency
|