博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
call Kernelized Correlation Filters Tracker(Matab) in Qt(c++)
阅读量:6821 次
发布时间:2019-06-26

本文共 2603 字,大约阅读时间需要 8 分钟。

recently, i need call the KCF tracker in my graduation project. the KCF tracker is fast and best performance now. see , however, this only matlab version of KCF code in the author's homepage. i need to implement KCF in c++ version, however, i find it is hard to do it, because this is no opencv version of fhog which is used in the matlab version. and the correlation of complex number is hard too. So in the last , i build Windows Standalone Application. and it is easy to improve in matlab.

so let do it now.

build matlab Windows Standalone Application

first let make a file runKCFexe.m

function runKCFexe( base_path ,video)%./data/Benchmark/ Boyinterp_factor = 0.02;kernel.sigma = 0.5;kernel.type = 'gaussian';kernel.poly_a = 1;kernel.poly_b = 9;feature_type = 'hog';features.hog = true;features.gray = false;features.hog_orientations = 9;cell_size = 4;padding = 1.5;  %extra area surrounding the targetlambda = 1e-4;  %regularizationoutput_sigma_factor = 0.1;  %spatial bandwidth (proportional to target)[img_files, pos, target_sz, ground_truth, video_path] = load_video_info(base_path, video);[positions, time] = tracker(video_path, img_files, pos, target_sz, ...            padding, kernel, lambda, output_sigma_factor, interp_factor, ...            cell_size, features, 0);        fileID = fopen('centerPointResult.txt','w');fprintf(fileID,'%d %d\n',positions');fclose(fileID);%fprintf('kcf finished %s\n','done');end

and edit the tracker.m to the follow:

2015-06-29_02.jpg

the box2[1] is the frame number and box2[2:5] is the rect box

2015-06-29_01.jpg

add the reference files like follows

2015-06-29_03.jpg

and then build

2015-06-29_04.jpg

and we will get the KCFexe.exe

test run the KCFexe.exe

2015-06-29_05.jpg

Yehh, it works

2015-06-29_06.jpg

Qt C++ programming

let's build a q widget application

2015-06-29_07.jpg

the OpenDir Button is used to select the dir path like

2015-06-29_08.jpg

the Qlabe is used to show the image.

the project dir structure

2015-06-29_11.jpg

2015-06-29_10.jpg

the dirpath and video is the Parameters for KCFexe.exe

frameNo is used for read NO.image from capture , procOutput is used to get the frame num and rect box from KCFexe.exe output and store in the s_data,capturePath is used for VideoCapture.open function , program is the KCFexe.exe path,on_pushButton_clicked() is to select the dir,readyReadStandardOutput() is to read the KCFexe.exe output,processRect() is used to show image in Qlabel.RectReady() is signal for processRect.

init and connect

2015-06-29_12.jpg

select dir

2015-06-29_13.jpg

run the KCFexe.exe

2015-06-29_14.jpg

read the output of KCFexe.exe

2015-06-29_15.jpg

show image in Qlabel

2015-06-29_16.jpg

Note ,because the speed of KCFexe.exe output is not the same with readyReadStandardOutput so the code is need in the processRect()

2015-06-29_17.jpg

finnally ,it run like this

demo2.gif

转载于:https://www.cnblogs.com/yuliyang/p/4608877.html

你可能感兴趣的文章
mysql远程连接
查看>>
application 启动多次
查看>>
PHP学习笔记 1 ----页面下拉框回显
查看>>
在Array原型链上扩展remove,contain等方法所遇到的坑
查看>>
linux 内存屏障 && C++11
查看>>
开发中遇到问题和解决方案集锦
查看>>
二进制表示
查看>>
javaEE项目中异常处理
查看>>
Nostro Account 本国银行在外国银行持有的外币账户
查看>>
linux搭建vsftp服务器
查看>>
JavaScript图片等比缩放
查看>>
JDK容器学习之HashMap (一) : 底层存储结构分析
查看>>
快排class
查看>>
列出文件和目录
查看>>
字典功能的简单实现
查看>>
Mac OS X 下搭建 Java 开发环境图解
查看>>
JBPM4或Activiti5的流程任务分发与汇总
查看>>
android4.0 在ubuntu10.04(64位)上的下载与编译
查看>>
记一次在 Linux 上创建 Django 应用的过程
查看>>
C++反射机制的实现
查看>>