资源简介
时空上下文视觉跟踪(STC)算法的代码,包含原作者的matlab代码和zouxy09博主实现的多尺度时空上下文视觉追踪C++代码,其中C++代码已经解决了边界处理问题。

代码片段和文件信息
#include “STCTracker.h“
#include
#include
#include
#include
#include
// Global variables
Rect box;
bool drawing_box = false;
bool gotBB = false;
// bounding box mouse callback
void mouseHandler(int event int x int y int flags void *param){
switch( event ){
case CV_EVENT_MOUSEMOVE:
if (drawing_box){
box.width = x-box.x;
box.height = y-box.y;
}
break;
case CV_EVENT_LBUTTONDOWN:
drawing_box = true;
box = Rect( x y 0 0 );
break;
case CV_EVENT_LBUTTONUP:
drawing_box = false;
if( box.width < 0 ){
box.x += box.width;
box.width *= -1;
}
if( box.height < 0 ){
box.y += box.height;
box.height *= -1;
}
gotBB = true;
break;
}
}
int main(int argc char * argv[])
{
VideoCapture capture;
capture.open(“C:\\Users\\Administrator\\Desktop\\David.avi“);
bool fromfile = true;
if (!capture.isOpened())
{
cout << “capture device failed to open!“ << endl;
return -1;
}
//Register mouse callback to draw the bounding box
cvNamedWindow(“Tracker“ CV_WINDOW_AUTOSIZE);
cvSetMouseCallback(“Tracker“ mouseHandler NULL );
Mat framefirstgrayImg;
capture >> frame;
frame.copyTo(first);
while(!gotBB)
{
first.copyTo(frame);
rectangle(frameboxScalar(25500)2);
imshow(“Tracker“ frame);
if (cvWaitKey(20) == 27)
return 1;
}
//Remove callback
cvSetMouseCallback(“Tracker“ NULL NULL );
printf(“Initial= x:%d y:%d h:%d w:%d\n“box.xbox.ybox.heightbox.width);
cvtColor(frame grayImg CV_RGB2GRAY);
STCTracker stcTracker;
stcTracker.init(grayImg box);
int frameCount = 0;
while (capture.read(frame))
{
if (frame.empty())
return -1;
double t = (double)cvGetTickCount();
frameCount++;
cvtColor(frame grayImg CV_RGB2GRAY);
stcTracker.tracking(grayImg box frameCount);
// show the result
stringstream buf;
buf << frameCount;
string num = buf.str();
putText(frame num Point(20 30) FONT_HERSHEY_SIMPLEX 1 Scalar(0 0 255) 3);
rectangle(frame box Scalar(0 0 255) 3);
imshow(“Tracker“ frame);
t = (double)cvGetTickCount() - t;
//cout << “cost time: “ << t / ((double)cvGetTickFrequency()*1000.) << endl;
if ( cvWaitKey(1) == 27 )
break;
}
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-09-20 20:58 STC(matlab和C++)\
目录 0 2016-09-20 20:58 STC(matlab和C++)\C++\
文件 2347 2015-06-05 20:33 STC(matlab和C++)\C++\runTracker.cpp
文件 8300 2015-06-05 20:32 STC(matlab和C++)\C++\STCTracker.cpp
文件 1585 2015-06-05 14:37 STC(matlab和C++)\C++\STCTracker.h
目录 0 2016-09-20 20:58 STC(matlab和C++)\Matlab\
目录 0 2016-09-20 21:02 STC(matlab和C++)\Matlab\data\
文件 4048 2016-09-20 17:29 STC(matlab和C++)\Matlab\demoSTC.m
文件 617 2013-11-03 15:01 STC(matlab和C++)\Matlab\get_context.m
文件 24 2013-10-27 12:07 STC(matlab和C++)\Matlab\readme.txt
- 上一篇:连续存储空间管理仿真系统
- 下一篇:c++程序图的遍历深度优先,广度优先
相关资源
- stc8g1k08特性.doc
- stc-isp-15xx-v6.86G
- STC8G1K08A红外遥控点灯
- 自绘CListCtrl聊天列表MFC
- Windows下基于ModbusTcp的Server端开发C语言
- 简易的心电采集电路,包括下位机编
- listctrl加入BUTTON复选框,编辑框,调整
- 基于MFC modbusTcp
- STC12C5410AD中文文档C语言版
- 单片机C语言库 STC89C51/52 AT89C52/51
- stc89c52单片机控制TC35模块收发短信接
- VC6.0将ListCtrl中数据写入到Excel
- STC15单片机ESP8266开发试验程序含原理
- 基于STC89C52RC使用霍尔元件测速测里程
- MFC ListControl使用
- MFC中ListCtrl添加图标,更改图标
- MFC树形控件CTreeCtrl显示文件路径及文
- STC15增强型8051单片机C语言编程与应用
- STC单片机C语言程序设计立体化教程
- 51单片机轻松入门__基于STC15W4K系列(
- C++版_STC跟踪代码(多尺度)
- 可以改变ListCtr控件中的显示颜色和背
- MFC ListCtrl控件上增加Comb以及可编写子
- STC单片机教程之STC15单片机实战指南(
- 51单片机轻松入门—基于STC15W4K系列
- MFC 列表控件(ListControl)扩展类集合
- 时空上下文跟踪STC
- STC15增强型8051单片机C语言编程与应用
- 51单片机轻松入门 C语言版 基于STC
- 毕业设计—基于STC89C51单片机的模拟电
评论
共有 条评论