Skip to content Skip to sidebar Skip to footer

How To Use Opencv Tracker Parameters Without Selecting A Roi

can someone tell me which second parameter I should pass to tracker.init() after detection a pedestrian? there are only parameters with already selected ROI in the internet. I trie

Solution 1:

According to opencv sample code https://github.com/opencv/opencv_contrib/blob/master/modules/tracking/samples/tracker.py, second parameter of tracker.init is bounding box:

cv.namedWindow("tracking")
camera = cv.VideoCapture(sys.argv[1])
ok, image=camera.read()
...
bbox = cv.selectROI("tracking", image)
tracker = cv.TrackerMIL_create()
...
ok = tracker.init(image, bbox)

So, if you want to use detected pedestrian as ROI, you should use:

bbox = rects[index]
tracker.init(image, bbox)

where index is the number of detected pedestrian that you want to track

Post a Comment for "How To Use Opencv Tracker Parameters Without Selecting A Roi"