Update app.py
Browse files
app.py
CHANGED
@@ -58,7 +58,8 @@ def simple_threshold_blue(image_bgr):
|
|
58 |
total_pixels = image_bgr.shape[0] * image_bgr.shape[1]
|
59 |
perc_blue = (blue_pixels / total_pixels) * 100
|
60 |
return perc_blue, mask
|
61 |
-
|
|
|
62 |
def advanced_threshold_blue(image_bgr):
|
63 |
"""
|
64 |
Advanced approach:
|
@@ -88,7 +89,8 @@ def advanced_threshold_blue(image_bgr):
|
|
88 |
blue_pixels = cv2.countNonZero(cleaned_mask)
|
89 |
total_pixels = image_bgr.shape[0] * image_bgr.shape[1]
|
90 |
perc_blue = (blue_pixels / total_pixels) * 100
|
91 |
-
return perc_blue, cleaned_mask
|
|
|
92 |
|
93 |
def plot_color_histogram(image_bgr):
|
94 |
"""
|
@@ -180,7 +182,7 @@ else:
|
|
180 |
st.image(simple_mask, caption="Simple Mask (white=detected blue)", width=250)
|
181 |
|
182 |
st.markdown("---")
|
183 |
-
|
184 |
# Advanced Threshold
|
185 |
st.subheader("3) Advanced Threshold Approach")
|
186 |
adv_perc_blue, adv_mask = advanced_threshold_blue(img_bgr)
|
@@ -191,7 +193,7 @@ else:
|
|
191 |
st.progress(min(adv_perc_blue/100, 1.0))
|
192 |
with col6:
|
193 |
st.image(adv_mask, caption="Advanced Mask (white=detected blue)", width=250)
|
194 |
-
|
195 |
st.markdown("""
|
196 |
---
|
197 |
## Relevance to ITC PSPD:
|
|
|
58 |
total_pixels = image_bgr.shape[0] * image_bgr.shape[1]
|
59 |
perc_blue = (blue_pixels / total_pixels) * 100
|
60 |
return perc_blue, mask
|
61 |
+
|
62 |
+
"""
|
63 |
def advanced_threshold_blue(image_bgr):
|
64 |
"""
|
65 |
Advanced approach:
|
|
|
89 |
blue_pixels = cv2.countNonZero(cleaned_mask)
|
90 |
total_pixels = image_bgr.shape[0] * image_bgr.shape[1]
|
91 |
perc_blue = (blue_pixels / total_pixels) * 100
|
92 |
+
return perc_blue, cleaned_mask
|
93 |
+
"""
|
94 |
|
95 |
def plot_color_histogram(image_bgr):
|
96 |
"""
|
|
|
182 |
st.image(simple_mask, caption="Simple Mask (white=detected blue)", width=250)
|
183 |
|
184 |
st.markdown("---")
|
185 |
+
"""
|
186 |
# Advanced Threshold
|
187 |
st.subheader("3) Advanced Threshold Approach")
|
188 |
adv_perc_blue, adv_mask = advanced_threshold_blue(img_bgr)
|
|
|
193 |
st.progress(min(adv_perc_blue/100, 1.0))
|
194 |
with col6:
|
195 |
st.image(adv_mask, caption="Advanced Mask (white=detected blue)", width=250)
|
196 |
+
"""
|
197 |
st.markdown("""
|
198 |
---
|
199 |
## Relevance to ITC PSPD:
|