• 大小: 22KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-03
  • 语言: C/C++
  • 标签: KCF  跟踪  

资源简介

KCF跟踪算法

资源截图

代码片段和文件信息

#include 

#include “kcf.h“
#include “vot.hpp“

int main()
{
    //load region images and prepare for output
    VOT vot_io(“region.txt“ “images.txt“ “output.txt“);

    KCF_Tracker tracker;
    cv::Mat image;

    //img = firts frame initPos = initial position in the first frame
    cv::Rect init_rect = vot_io.getInitRectangle();
    vot_io.outputBoundingBox(init_rect);
    vot_io.getNextImage(image);

    BBox_c bb;
    bb.cx = init_rect.x + init_rect.width/2.;
    bb.cy = init_rect.y + init_rect.height/2.;
    bb.w = init_rect.width;
    bb.h = init_rect.height;
    tracker.init(image bb);

    double avg_time = 0.;
    int frames = 0;
    while (vot_io.getNextImage(image) == 1){
        double time_profile_counter = cv::getCPUTickCount();
        tracker.track(image);
        time_profile_counter = cv::getCPUTickCount() - time_profile_counter;
        //std::cout << “  -> speed : “ <<  time_profile_counter/((double)cvGetTickFrequency()*1000) << “ms. per frame“ << std::endl;
        avg_time += time_profile_counter/((double)cvGetTickFrequency()*1000);
        frames++;

        bb = tracker.getBBox();
        vot_io.outputBoundingBox(cv::Rect(bb.cx - bb.w/2. bb.cy - bb.h/2. bb.w bb.h));

       // cv::rectangle(image cv::Rect(bb.cx - bb.w/2. bb.cy - bb.h/2. bb.w bb.h) CV_RGB(02550) 2);
       // cv::imshow(“output“ image);
       // cv::waitKey();

//        std::stringstream s;
//        std::string ss;
//        int countTmp = frames;
//        s << “imgs“ << “/img“ << (countTmp/10000);
//        countTmp = countTmp%10000;
//        s << (countTmp/1000);
//        countTmp = countTmp%1000;
//        s << (countTmp/100);
//        countTmp = countTmp%100;
//        s << (countTmp/10);
//        countTmp = countTmp%10;
//        s << (countTmp);
//        s << “.jpg“;
//        s >> ss;
//        //set image output parameters
//        std::vector compression_params;
//        compression_params.push_back(CV_IMWRITE_JPEG_QUALITY);
//        compression_params.push_back(90);
//        cv::imwrite(ss.c_str() image compression_params);
    }

    std::cout << “Average processing speed “ << avg_time/frames <<  “ms. (“ << 1./(avg_time/frames)*1000 << “ fps)“ << std::endl;

    return EXIT_SUCCESS;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-12-16 12:47  kcf-master\
     文件          48  2015-12-16 12:47  kcf-master\.gitignore
     文件         748  2015-12-16 12:47  kcf-master\CMakeLists.txt
     文件        4153  2015-12-16 12:47  kcf-master\README.md
     文件        2270  2015-12-16 12:47  kcf-master\main_vot.cpp
     目录           0  2015-12-16 12:47  kcf-master\src\
     文件         263  2015-12-16 12:47  kcf-master\src\CMakeLists.txt
     文件        5846  2015-12-16 12:47  kcf-master\src\complexmat.hpp
     文件       13187  2015-12-16 12:47  kcf-master\src\kcf.cpp
     文件        2933  2015-12-16 12:47  kcf-master\src\kcf.h
     目录           0  2015-12-16 12:47  kcf-master\src\piotr_fhog\
     文件         264  2015-12-16 12:47  kcf-master\src\piotr_fhog\CMakeLists.txt
     文件        3080  2015-12-16 12:47  kcf-master\src\piotr_fhog\fhog.hpp
     文件       18893  2015-12-16 12:47  kcf-master\src\piotr_fhog\gradientMex.cpp
     文件         569  2015-12-16 12:47  kcf-master\src\piotr_fhog\gradientMex.h
     文件        3125  2015-12-16 12:47  kcf-master\src\piotr_fhog\sse.hpp
     文件        1593  2015-12-16 12:47  kcf-master\src\piotr_fhog\wrappers.hpp
     文件        5024  2015-12-16 12:47  kcf-master\vot.hpp

评论

共有 条评论