INNER CODE UNIT · Python
origin_rect
stereolabs/zed-sdk · zed one/python/streaming_receiver.py:36
origin_rect = (-1,-1 )
def on_mouse(event,x,y,flags,param):
global select_in_progress,selection_rect,origin_rect
if event == cv2.EVENT_LBUTTONDOWN:
origin_rect = (x, y)
select_in_progress = True
elif event == cv2.EVENT_LBUTTONUP:
select_in_progress = False
elif event == cv2.EVENT_RBUTTONDOWN:
select_in_progress = False
selection_rect = sl.Rect(0,0,0,0)
if select_in_progress:
selection_rect.x = min(x,origin_rect[0])
selection_rect.y = min(y,origin_rect[1])
selection_rect.width = abs(x-origin_rect[0])+1