Ask Your Question
0

How to use python T-API with the tracking module?

asked 2017-03-14 04:30:51 -0600

adeelh gravatar image

I tried

tracker = cv2.Tracker_create("TLD")
img_umat = cv2.UMat(img)
tracker.init(img_umat, (x, y, w, h))

But it says TypeError: image is not a numpy array, neither a scalar.

What is the correct usage?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-03-14 04:45:51 -0600

berak gravatar image

the tracking api does not have any explicit opencl acceleration, so using UMat's here is not nessecary.

since Tracker::init() expects a cv::Mat, you'd have to give it a plain numpy array, not a UMat.

if, on the other hand, you have a UMat (e.g. from previous processing), use:

tracker.init(img_umat.get(), (x, y, w, h))
edit flag offensive delete link more

Comments

I do see some opencl related code in the tracking module's cpp files. But I don't seem to be getting any GPU acceleration. Does it use opencl internally if it is present?

adeelh gravatar imageadeelh ( 2017-03-14 12:44:54 -0600 )edit

oh, where so ? (i probably missed something)

main problem is still, that from python, you have to use the Tracker interface, which is using cv::Mat as input (not InputArray), so no way to get a Umat in, currently.

berak gravatar imageberak ( 2017-03-14 13:04:13 -0600 )edit

In tldTracker.cpp, tldModel.cpp, tldDetector.cpp. Also in the multi-tracker files.

adeelh gravatar imageadeelh ( 2017-03-14 13:34:26 -0600 )edit

ah, ofc. you're right, missed it.

but it would still be a long way, to transport a UMat from input to there .. ;(

berak gravatar imageberak ( 2017-03-14 13:41:07 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-03-14 04:30:51 -0600

Seen: 603 times

Last updated: Mar 14 '17