@@ -100,11 +100,12 @@ def was_key_pressed(self, key: str) -> bool:
100100
101101
102102class DrawSingleLineWidget (object ):
103- def __init__ (self , background_img , window_name , preview_scaling ):
103+ def __init__ (self , background_img , window_name , preview_scaling , color = ( 36 , 255 , 12 ) ):
104104 self .original_image = background_img
105105 self .clone = self .original_image .copy ()
106106 self .window_name = window_name
107107 self .preview_scaling = preview_scaling
108+ self .color = color
108109
109110 cv2 .namedWindow (window_name )
110111 cv2 .setMouseCallback (window_name , self .extract_coordinates )
@@ -122,7 +123,7 @@ def extract_coordinates(self, event, x, y, flags, parameters):
122123 elif event == cv2 .EVENT_LBUTTONUP :
123124 self .end_coordinate = (x ,y )
124125 self .clone = self .original_image .copy ()
125- cv2 .line (self .clone , self .start_coordinate , self .end_coordinate , ( 36 , 255 , 12 ) , 2 )
126+ cv2 .line (self .clone , self .start_coordinate , self .end_coordinate , self . color , 2 )
126127
127128 def show_image (self ):
128129 return self .clone
0 commit comments