资源简介
时空上下文跟踪算法,是最近几年出来比较新的跟踪,基友opencv和c++编写,配置好后可以直接运行,跟踪效果理想,对于跟踪一块理解非常好
代码片段和文件信息
// RunSTC.cpp : 定义控制台应用程序的入口点。
//
#include “stdafx.h“
#include “STCtracker.h“
// Global variables
Rect box;
bool drawing_box = false;
bool gotBB = false;
char srcvideo[] = “E:\\vs调试\\测试视频\\camera1_mov.avi“;
// 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 _tmain(int argc _TCHAR* argv[])
{
/*VideoCapture capture;
capture.open(srcvideo); */
bool fromfile = true;
CvCapture* capture = cvCaptureFromFile(“E:\\vs调试\\测试视频\\skating1(low frame rate).avi“);
/*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 );
/*capture >> frame; */
Mat frame;
frame = cvQueryframe(capture);
imshow(“Tracker“ frame);
while(!gotBB)
{
if (!fromfile)
frame = cvQueryframe(capture);
/*capture >> frame; */
imshow(“Tracker“ frame);
if (cvWaitKey(20) == 27)
return 1;
}
//Remove callback
cvSetMouseCallback(“Tracker“ NULL NULL );
box.x = 162;
box.y = 170;
box.width = 35;
box.height = 100;
STCTracker stcTracker;
stcTracker.init(frame box);
int frameCount = 0;
while (1)
{
/*capture >> frame; */
frame = cvQueryframe(capture);
if (frame.empty())
return -1;
double t = (double)cvGetTickCount();
frameCount++;
// tracking
stcTracker.tracking(frame box);
// 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-04-12 22:27 RunSTC\
目录 0 2016-04-11 21:30 RunSTC\Debug\
文件 103936 2016-04-11 22:05 RunSTC\Debug\RunSTC.exe
文件 876248 2016-04-11 22:05 RunSTC\Debug\RunSTC.ilk
文件 1797120 2016-04-11 22:05 RunSTC\Debug\RunSTC.pdb
目录 0 2016-04-12 22:10 RunSTC\ipch\
目录 0 2016-04-12 22:10 RunSTC\ipch\runstc-7ef7deaf\
文件 2359296 2016-04-12 22:10 RunSTC\ipch\runstc-7ef7deaf\runstc-fc2a456b.ipch
目录 0 2016-04-11 21:29 RunSTC\RunSTC\
文件 35868672 2016-04-12 22:27 RunSTC\RunSTC.sdf
文件 885 2016-04-11 21:21 RunSTC\RunSTC.sln
文件 12288 2016-04-12 22:27 RunSTC\RunSTC.suo
目录 0 2016-04-11 22:05 RunSTC\RunSTC\Debug\
文件 2712 2016-04-11 22:05 RunSTC\RunSTC\Debug\cl.command.1.tlog
文件 52506 2016-04-11 22:05 RunSTC\RunSTC\Debug\CL.read.1.tlog
文件 1178 2016-04-11 22:05 RunSTC\RunSTC\Debug\CL.write.1.tlog
文件 2 2016-04-11 22:05 RunSTC\RunSTC\Debug\li
文件 2 2016-04-11 22:05 RunSTC\RunSTC\Debug\li
文件 2 2016-04-11 22:05 RunSTC\RunSTC\Debug\li
文件 2 2016-04-11 22:05 RunSTC\RunSTC\Debug\li
文件 2 2016-04-11 22:05 RunSTC\RunSTC\Debug\li
文件 2 2016-04-11 22:05 RunSTC\RunSTC\Debug\li
文件 2202 2016-04-11 22:05 RunSTC\RunSTC\Debug\li
文件 4464 2016-04-11 22:05 RunSTC\RunSTC\Debug\li
文件 734 2016-04-11 22:05 RunSTC\RunSTC\Debug\li
文件 346 2016-04-11 22:05 RunSTC\RunSTC\Debug\mt.command.1.tlog
文件 250 2016-04-11 22:05 RunSTC\RunSTC\Debug\mt.read.1.tlog
文件 250 2016-04-11 22:05 RunSTC\RunSTC\Debug\mt.write.1.tlog
文件 454 2016-04-11 21:30 RunSTC\RunSTC\Debug\rc.command.1.tlog
文件 222 2016-04-11 21:30 RunSTC\RunSTC\Debug\rc.read.1.tlog
文件 230 2016-04-11 21:30 RunSTC\RunSTC\Debug\rc.write.1.tlog
............此处省略22个文件信息
- 上一篇:effective c++中文版第三版pdf
- 下一篇:C++编写电压电流表仪表盘
相关资源
- qtOpenGLDemo2.rar
- opengl圆柱贴图程序,可以直接运行
- 基于Opencv的相机操作代码
- Learning OpenCV3 Computer Vision in C++ with t
- MFC Opencv显示图片,图片类型为Mat
- OpenCV人脸识别实例源码142702
- 疲劳检测vc++和opencv编程源代码
- opengl绘制坐标
- opencv人脸检测与跟踪
- CAD应用程序开发详解
- InfoPower VCL for RAD Studio 10.2 for Tokyo v1
- opencv+directshow同步打开4个摄像头
- Qt结合OpenCV和VC++实现调用摄像头拍照
- 基于MFC的人脸检测程序使用OpenCV实现
- centOS7安装nginx安装包以及所有依赖包
- opencv mfc vs2017读取图片,向图片加入噪
- MFCretry1.rar
- vs2015+opencv3.3+mfc读取摄像头显示在图片
- 应用opencv库项目(Visual Studioc++)的
- c++二维码定位和识别+zbar+opencv+ubuntu
- 喷码字符识别
- 基于OpenCV+MFC的视频监测实现行人检测
- Vs2015+Qt5.8+Opencv读取大恒水晶 MER-131摄
- opencv手写数字识别C++
- OPC通讯C++实现,实现PC与西门子S7120
- OpenCV算法精解 基于Python与C++
- Emgucvopencv+C#例程集锦
- 基于深度学习识别人脸性别和年龄
- opencv-3.4.10.rar
- MFC+VS2013+OPENCV打开视频,带有滑动条拖
评论
共有 条评论