tracking points

asked 2019-05-27 18:33:00 -0600

updated 2019-05-28 06:54:27 -0600

berak gravatar image

image description

as you can see now I have six points in this picture, I know that mouse callback function can track one point at one time. I am wondering can I use the mouse callback function to track all the six points at the same time.

best,

edit retag flag offensive close merge delete

Comments

helo, it's somewhat unclear, what you mean by "mouse callback function can track one point at one time." can you try to explain ?

berak gravatar imageberak ( 2019-05-28 04:30:42 -0600 )edit

hi Berak,

here is part of the mouse callback function that can click the point on the video.

but this function can just choose one point. Code:

def select_point(event, x, y, flags, params):
    # grab references to the global variables
    global point, point_selected, old_points
    # if the left mouse button was clicked, record the starting
    # (x, y) coordinates and indicate that cropping is being
    # performed
    if event == cv2.EVENT_LBUTTONDOWN:#indicates that the left mouse button is pressed.
    point = (x, y) #choose one point, here is its position
    point_selected = True
    old_points = np.array([[x, y]], dtype=np.float32)# create an array
procrastinator gravatar imageprocrastinator ( 2019-05-28 12:03:22 -0600 )edit