cv2.createTrackbar using python

后端 未结 1 1611
灰色年华
灰色年华 2021-01-12 14:01

I\'m a newbie in python and opencv, I want to create a track-bar to control the hierarchy of the function cv2.findContours but I don\'t know how to add it to the source code

1条回答
  •  借酒劲吻你
    2021-01-12 14:53

    I hope you have solved your problems by now, but I will try to explain it in case you haven't. You can create a window using the named window function and then associate the trackbar to that window.

    cv2.namedWindow('test')
    cv2.createTrackbar('thrs1', 'test', 300, 800, callback)
    # Do whatever you want with contours
    cv2.imshow('test', frame)
    

    You will find the function createTrackbar explained here: cv2.createTrackbar

    callback is pointer to the function that will be called everytime the slides changes it's position.

    0 讨论(0)
提交回复
热议问题