Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

kcf tracker in python

Using opencv3.x, the following code works in python:

import cv2
p_img = ''  # path of the image
bb = []  # bounding box of the image here
tracker = cv2.Tracker_create('MIL')
pix = cv2.imread(p_img)
pix = cv2.convertScaleAbs(pix, cv2.COLOR_GRAY2BGR)
ok = tracker.init(pix, bb)
tracker.update(pix)

If I change it to 'KCF' instead of 'MIL' though it returns an empty bounding box. Tried to figure out from the file here, but couldn't figure out why it should be different call.

Any help would be appreciated.

Thanks