OCV 4.5.3 tracking.hpp where is TrackerKCF

OpenCV 4.5.3, C++, Visual Studio 2017, MFC, Windows 10

Trying to create a TrackerKCF:

In the VS project’s Additional Dependencies I have entered
opencv_tracking453.lib

In the header:

#include <opencv2/video/tracking.hpp>
#include <opencv2/core/ocl.hpp>
#include <opencv2/core/utility.hpp>

In the code:
Ptr<Tracker> OCVtracker = TrackerKCF::create();

This line gave me an error
Error C2653 ‘TrackerKCF’: is not a class or namespace name

Just to try I entered instead:
Ptr<Tracker> OCVtracker = TrackerGOTURN::create();
and that worked. So I went to the tracking.hpp and see that the only tracker classes are for GOTURN, MIL, and DaSiamRPN .

What happened to TrackerKCF?

Ed

what did you install, and how ?

to access TrackerKCF you’d need to build from src with contrib modules

Ahhh. Maybe that is it. Yes I built with Cmake and compiled with VS 2017 but I need to revisit that CMake to see if I included the contrib modules.

Thanks for this headsup. I’ll check it out.

Ed

I can’t find the contrib modules anywhere. As far as CMake is concerned I have all of the boxes checked for BUILD_opencv_ except for the _world and a couple of the _js… Trying to set the OPENCV_EXTRA_MODULES_PATH I can’t find any module that would insinuate contrib or tracking for that matter.

Do you happen to know if they changed the name of the contrib module to something else? I looked at the 3rdparty directory but, again, nothing jumped out.

Any ideas?

Ed

Never mind…I found in the readme.md file

Additional OpenCV functionality: https://github.com/opencv/opencv_contrib

I’ll follow that lead.

Ed

yea beat me …
there’s a tracking module in contrib, and you need that for the KCF

you probably missed, that it’s another repo to dowload from github

just make sure, you got exactly the same version for both repos
(default download for contrib will be “master”, and your main seems 4.5.3)

I’ve downloaded the opencv_contrib-4.x.zip file, unzipped it, pointed to the

opencv_contrib>/modules

for the OPENCV_EXTRA_MODULES_PATH and configured and generated in CMake. I’m recompiling in VS 2017 as we speak.

I had done a rapid transition from OCV 2.4 to 4.5 and never caught the fact that they made contrib a separate download. I’m pretty sure this will solve my problem.

Thanks a million for the headsup.

Ed

1 Like

for smooth transition, and since you’re building from scratch anyway,
update your main opencv repo to 4.x, too
(also clean cmake artefacts / build folder!)

Well, my main OpenCV is currently 4.5.3. Are you saying go ahead and get 4.5.4?

I guess that I could but I’m always just trying to put out one fire or another and am paranoid about stopping to polish things while I am running around. Maybe soon :wink:

Ed