Ask Your Question
1

kcf tracker in python

asked 2016-02-01 07:46:28 -0600

grigoris gravatar image

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

edit retag flag offensive close merge delete

Comments

  • a test image would be nice..

  • also, i hope you gave it a valid bb in tracker.init()

  • can you try the python sample in the tracking folder ?

  • (but yea, nothing detected for KCF here, too.)

berak gravatar imageberak ( 2016-02-01 07:48:59 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2016-04-21 12:20:18 -0600

Algold gravatar image

updated 2016-04-21 12:23:04 -0600

It seems to be a bug caused by the way the tracked bounding box is returned in C++ and in Python. I fixed the problem and made a pull request. The issue with the reference to the pull request is here.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-02-01 07:46:28 -0600

Seen: 7,393 times

Last updated: Apr 21 '16