使用MIL跟踪器和跟踪标头时出错

时间:2017-05-09 08:28:42

标签: opencv

嗨,大家下面是我的代码,我在创建中遇到错误(const String& TrackerMIL),我收到的错误就像在这个链接中https://pastebin.com/0x52tJL6,请帮忙,你们都知道我添加了opencv3中的额外模块opencv_contrib。请帮帮我们谢谢

#include <opencv2/opencv.hpp>

#include <opencv2/tracking/tracking.hpp>


using namespace cv;
using namespace std;

int main(int argc, char **argv)
{
    // Set up tracker.
    // Instead of MIL, you can also use
    // BOOSTING, KCF, TLD, MEDIANFLOW or GOTURN
    Ptr<Tracker> Tracker::create( const String& TrackerMIL );

    // Read video
    VideoCapture video("videos/chaplin.mp4");

    // Check video is open
    if(!video.isOpened())
    {
        cout << "Could not read video file" << endl;
        return 1;
    }

    // Read first frame.
    Mat frame;
    video.read(frame);

    // Define an initial bounding box
    Rect2d bbox(287, 23, 86, 320);

    // Uncomment the line below if you
    // want to choose the bounding box
    // bbox = selectROI(frame, false);

    // Initialize tracker with first frame and bounding box
    tracker->init(frame, bbox);

    while(video.read(frame))
    {
        // Update tracking results
      tracker->update(frame, bbox);

        // Draw bounding box
      rectangle(frame, bbox, Scalar( 255, 0, 0 ), 2, 1 );


      // Display result
      imshow("Tracking", frame);
      int k = waitKey(1);
      if(k == 27) break;

    }

    return 0;

}

1 个答案:

答案 0 :(得分:0)

这是在针对上述错误正确包含标题之后解决的,因为它无法找到我的libopencv_tracking.so.3.2,我不得不sudo apt-get update和sudo apt-get upgrade ..现在它正在工作一切都很好,

谢谢