资源简介
在zouxy09大神单尺度c++版STC代码的基础上进行了多尺度复现 并解决了边界处理问题 望学习STC的同学共同交流啊

代码片段和文件信息
#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;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2347 2015-06-05 20:33 多尺度STC_C++\runTracker.cpp
文件 8300 2015-06-05 20:32 多尺度STC_C++\STCTracker.cpp
文件 1585 2015-06-05 14:37 多尺度STC_C++\STCTracker.h
目录 0 2015-06-08 10:48 多尺度STC_C++
----------- --------- ---------- ----- ----
12232 4
- 上一篇:基于51单片机的数字频率计程序仿真图及代码
- 下一篇:电能表软件系统设计
相关资源
- STC8951系列单片机中方指南
- Omron ETN21模块进行modbustcp通讯
- 基于MFC扩展CListCtrl子项显示图片并叠
- STC12C5A60S2 CH4521 驱动数码管 显示
- 可编辑的CListctrl 支持CEDIT文本框,C
- STC12C系列单片机函数库
- CListCtrlExDemo.rar
- 适用于STC单片机和51单片机的SX1262驱动
- EESkill NRF24L01 无线模块用户手册
- IAP15f2k61s2
- 校园一卡通系统中RFID读写器的设计
- 基于GIS的地下水流可视化多尺度数值
- STC11F04单片机串口终端程序
- STC11F32单片机的射频读卡器设计
- STC-ISP_V4.83
- 基于STC89C52的瓦斯检测及红外控制系统
- ROST内容挖掘软件
- 基于51单片机的超声波测距技术实现含
- RC522读写MI卡程序,STC89C52RC调试通过,
- STC89C52+LCD12864+18B20+1302万年历
- STC库文件 STC.CDB
- 单片机89c52与MLX90614红外的测温程序
- stc8单片机12位ad程序查询模式
- 一种基于LBM的气液固三相流多尺度模
- 测试STC15W408AS单片机串口收发
- 多尺度hessian滤波器图像增强
- STC-ISP51单片机
- ESP8266AP模式控制51单片机亮灯.docx
- [Altium_Designer]_STC89C52单片机最小系统原
- 51单片机控制步进电机软硬件实现
评论
共有 条评论