File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -186,9 +186,11 @@ def mouse_callback(
186
186
_param ,
187
187
):
188
188
if len (self .points ) >= self .max_points :
189
- print (
190
- "Maximum number of points (2) reached. Press ENTER to continue or 'c' to clear."
191
- )
189
+ if not hasattr (self , "max_points_reached" ):
190
+ print (
191
+ "Maximum number of points (2) reached. Press ENTER to continue or 'c' to clear."
192
+ )
193
+ self .max_points_reached = True
192
194
return
193
195
194
196
if event == cv2 .EVENT_LBUTTONDOWN : # Left click for foreground
@@ -207,6 +209,10 @@ def mouse_callback(
207
209
f"Added background point at ({ x } , { y } ). { points_left } point{ 's' if points_left != 1 else '' } remaining."
208
210
)
209
211
212
+ # Reset the flag if points are cleared
213
+ if len (self .points ) < self .max_points and hasattr (self , "max_points_reached" ):
214
+ delattr (self , "max_points_reached" )
215
+
210
216
def _update_display (self ):
211
217
self .display_image = self .image .copy ()
212
218
You can’t perform that action at this time.
0 commit comments