Ask Your Question

Revision history [back]

A couple problems.

Coding Related

  1. I stand to be corrected but in C++, #include <opencv2 tracking="" tracking.hpp=""> is an invalid statement. In order to include the tracking header, you need this #include <opencv2/tracking.hpp> instead. Read more on header files.

  2. Class names are case-sensitive. Ptr<tracker> tracker != Ptr<Tracker> tracker. OpenCV's class is called Tracker and not tracker.

To add onto this, depending on the OpenCV version; from 3.1.0 onwards, Ptr<Tracker> tracker = Tracker::create("KCF"); is actually an invalid statement as well. This was changed to Ptr<Tracker> tracker = TrackerKCF::create(); Here's more info how this API was changed from 3.1.0.

Linker Related

Linker errors occur when the compiler just fails to find all of the appropriate ingredients to create an executable that can be loaded onto your OS. Typo in function/method names, missing main() etc. I would recommend you read more about these errors.

For your case, since tracking is an opencv_contrib module and according to their README:

to run, linker flags to contrib modules will need to be added to use them in your code/IDE. For example to use the aruco module, "-lopencv_aruco" flag will be added.

To fix this, navigate to your Project->Build Settings-> (Search for Other Linker).

Under Other Linker Flags, add -lopencv_tracking then build your project.

Always remember to add flags for each contrib module used.

Happy coding, cheers mate ;)

A couple problems.

Coding Related

  1. I stand to be corrected but in C++, #include <opencv2 tracking="" tracking.hpp=""> is an invalid statement. In order to include the tracking header, you need this #include <opencv2/tracking.hpp> instead. Read more on header files.

  2. Class names are case-sensitive. Ptr<tracker> tracker != Ptr<Tracker> tracker. OpenCV's class is called Tracker and not tracker.

To add onto this, depending on the OpenCV version; from 3.1.0 onwards, Ptr<Tracker> tracker = Tracker::create("KCF"); is actually an invalid statement as well. This was changed to Ptr<Tracker> tracker = TrackerKCF::create(); Here's more info how this API was changed from 3.1.0.

Linker Related

Linker errors occur when the compiler just fails to find all of the appropriate ingredients to create an executable that can be loaded onto your OS. Typo in function/method names, missing main() etc. etc are some of the culprits. I would recommend you read more about these errors.

For your case, since tracking is an opencv_contrib module and according to their README:

to run, linker flags to contrib modules will need to be added to use them in your code/IDE. For example to use the aruco module, "-lopencv_aruco" flag will be added.

To fix this, navigate to your Project->Build Settings-> (Search for Other Linker).

Under Other Linker Flags, add -lopencv_tracking then build your project.

Always remember to add flags for each contrib module used.

Happy coding, cheers mate ;)

A couple problems.

Coding Related

  1. I stand to be corrected but in C++, #include <opencv2 tracking="" tracking.hpp=""> is an invalid statement. In order to include the tracking header, you need this #include <opencv2/tracking.hpp> instead. Read more on header files.

  2. Class names are case-sensitive. Ptr<tracker> tracker != Ptr<Tracker> tracker. OpenCV's class is called Tracker and not tracker.

To add onto this, depending on the OpenCV version; from 3.1.0 onwards, Ptr<Tracker> tracker = Tracker::create("KCF"); is actually an invalid statement as well. This was changed to Ptr<Tracker> tracker = TrackerKCF::create(); Here's more info how this API was changed from 3.1.0.

Linker Related

Linker errors occur when the compiler just fails to find all of the appropriate ingredients to create an executable that can be loaded onto your OS. Typo in function/method names, missing main() etc are some of the culprits. I would recommend you read more about these errors.

For your case, since tracking is an opencv_contrib module and according to their README:

to run, linker flags to contrib modules will need to be added to use them in your code/IDE. For example to use the aruco module, "-lopencv_aruco" flag will be added.

To fix this, navigate to your Project->Build Settings-> (Search for Other Linker).

Under Other Linker Flags, add -lopencv_tracking then build your project.

Always remember to add flags for each contrib module used.

Happy coding, cheers mate ;)