Spaces:
Runtime error
Runtime error
Commit
·
08008c0
1
Parent(s):
8e42a00
update
Browse files
app.py
CHANGED
@@ -115,7 +115,10 @@ def update_displayed_quadrilateral(index, point_combinations, base_image_path):
|
|
115 |
# Display the image with the selected quadrilateral
|
116 |
display_image_with_quadrilateral(base_image, quad_points)
|
117 |
|
118 |
-
def process_image(image_path, flag_lower, flag_upper, plant_lower, plant_upper):
|
|
|
|
|
|
|
119 |
img = cv2.imread(image_path)
|
120 |
|
121 |
# Check if image is valid
|
@@ -174,15 +177,17 @@ def process_image(image_path, flag_lower, flag_upper, plant_lower, plant_upper):
|
|
174 |
# Show initial quadrilateral
|
175 |
centroids = update_displayed_quadrilateral(selected_quad_index)
|
176 |
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
|
|
|
|
186 |
|
187 |
# If there are exactly 4 largest contours, proceed with existing logic
|
188 |
elif len(significant_contours) == 4:
|
|
|
115 |
# Display the image with the selected quadrilateral
|
116 |
display_image_with_quadrilateral(base_image, quad_points)
|
117 |
|
118 |
+
def process_image(image_path, flag_lower, flag_upper, plant_lower, plant_upper, loc):
|
119 |
+
with loc:
|
120 |
+
btn_back, btn_next = st.columns([2,2])
|
121 |
+
|
122 |
img = cv2.imread(image_path)
|
123 |
|
124 |
# Check if image is valid
|
|
|
177 |
# Show initial quadrilateral
|
178 |
centroids = update_displayed_quadrilateral(selected_quad_index)
|
179 |
|
180 |
+
with btn_back:
|
181 |
+
# Button to go to the previous quadrilateral
|
182 |
+
if st.button('Previous'):
|
183 |
+
selected_quad_index = max(selected_quad_index - 1, 0)
|
184 |
+
centroids = update_displayed_quadrilateral(selected_quad_index)
|
185 |
+
|
186 |
+
with btn_next:
|
187 |
+
# Button to go to the next quadrilateral
|
188 |
+
if st.button('Next'):
|
189 |
+
selected_quad_index = min(selected_quad_index + 1, len(point_combinations) - 1)
|
190 |
+
centroids = update_displayed_quadrilateral(selected_quad_index)
|
191 |
|
192 |
# If there are exactly 4 largest contours, proceed with existing logic
|
193 |
elif len(significant_contours) == 4:
|