Error: undefined reference to 'cv::TrackerKCF::create()'

hi, i am trying run a code based on tracking.


using namespace std;
using namespace cv;
int main( int argc, char** argv ){
  // show help
      " Usage: tracker <video_name>\n"
      " examples:\n"
      " example_tracking_kcf Bolt/img/%04d.jpg\n"
      " example_tracking_kcf faceocc2.webm\n"
      << endl;
    return 0;
  // declares all required variables
  Rect2d roi;
  Mat frame;
  // create a tracker object
  Ptr tracker = TrackerKCF::create();
  // set input video
  std::string video = argv[1];
  VideoCapture cap(video);
  // get bounding box
  cap >> frame;
  //quit if ROI was not selected
  if(roi.width==0 || roi.height==0)
    return 0;
  // initialize the tracker
  // perform the tracking process
  printf("Start the tracking process, press ESC to quit.\n");
  for ( ;; ){
    // get frame from the video
    cap >> frame;
    // stop the program if no more images
    if(frame.rows==0 || frame.cols==0)
    // update the tracking result
    // draw the tracked object
    rectangle( frame, roi, Scalar( 255, 0, 0 ), 2, 1 );
    // show image with the tracked object
    //quit on ESC button
  return 0;

Actually i have a cross compiler. i am using the ‘make’ file to do so. And i am getting the following error.

src/MyApp.cpp:603: error: undefined reference to 'cv::TrackerKCF::create()'
src/MyApp.cpp:614: error: undefined reference to 'cv::Tracker::init(cv::_InputArray const&, cv::Rect_ const&)'
src/MyApp.cpp:624: error: undefined reference to 'cv::Tracker::update(cv::_InputArray const&, cv::Rect_&)'
collect2: error: ld returned 1 exit status
make: *** [all] Error 1

Please suggest some solution for this.

hi @hemasree

This is an application issue. You are using Classes and functions which are not defined in your libraries and/or sources?

Best regards,

hi @jaski.tx
I am missing with Tracking library
fatal error: opencv2/tracking/tracking.hpp: No such file or directory
How could i install this library?
Please provide a solution that can solve this problem.


We don’t have any experience with TLD tracker. You might have a look here.