资源简介
简单的人物跟踪识别,压缩包里面已经附加视频,点击exe程序可以直接运行
代码片段和文件信息
#ifdef _CH_
#pragma package
#endif
#ifndef _EiC
// include libs
#pragma comment(lib “cv.lib“)
#pragma comment(lib “highgui.lib“)
#pragma comment(lib “cxcore.lib“)
#include “cv.h“
#include “highgui.h“
#include
#include
#endif
IplImage *image = 0 *hsv = 0 *hue = 0 *mask = 0 *backproject = 0 *histimg = 0;
CvHistogram *hist = 0;
int select_object = 0; //select_object = 0临⊿伴匡ン 1伴匡
int track_object = 0; //1秨﹍tracking 0礚發羇ン -1﹍て model
CvPoint origin; //眔菲公畒夹┮竚
CvRect selection; //眔匡拒ROI戈癟
CvRect track_window;
CvConnectedComp track_comp;
int hdims = 30; //histo璶だ碭蝴
float hranges_arr[] = {0180}; //hueΤ0~180τ
float* hranges = hranges_arr;
bool g_bIsFinished = true;
// OpenCV 菲公牟祇㊣ㄧΑ
void on_mouse( int event int x int y int flags void* param ) //x-禸 ┕タ 程オ0 y-禸 ┕タ 程0
{
if( !image ) //ぶ璶Τimage翴菲公夹 玻ネROI ぃ礛铬
return;
if( image->origin ) //狦image->origin1赣瓜オ翴 0玥琌オ翴
y = image->height - y; //1玥рy竚 眖┕琌タ 跑Θオ0 match瓜畒夹禸
if( select_object ) //秨﹍select_object0 ┮秈ぃㄓ 琌璶┿菲公龄 碞秈眔ㄓ 秨﹍匡roi
{
selection.x = MIN(x origin.x); //菲公 オà繦跑 ┮update 程オx
selection.y = MIN(y origin.y);
selection.width = selection.x + CV_IABS(x - origin.x); //OFFSETX Yぃ禬筁俱跌怠
selection.height = selection.y + CV_IABS(y - origin.y); //CV_IAB荡癸 俱跌怠俱window竚
selection.x = MAX( selection.x 0 ); //X Y OFFSETぶ璶0 狦菲公╈禬筁跌怠 玥砞0
selection.y = MAX( selection.y 0 );
selection.width = MIN( selection.width image->width ); //狦糴┪筁跌怠 玥跌怠
selection.height = MIN( selection.height image->height ); //程ぃ穦禬筁跌怠
selection.width -= selection.x; //┮跌怠Ι奔OFFSET ぃ┤菲公╈簿跌怠
selection.height -= selection.y;
}
switch( event )
{
case CV_EVENT_LBUTTONDOWN:
{
origin = cvPoint(x y);
selection = cvRect(x y 0 0); //龄┿ ﹍て 眔roi﹍翴(Τ琌roiàㄤい翴)
select_object = 1; //ス┿菲公龄 碞单秨﹍匡ン
break;
}
case CV_EVENT_LBUTTONUP:
{
select_object = 0; //ス菲公龄 ン匡Ч
if( selection.width > 0 && selection.height > 0 )
track_object = -1; //Τroi 秨﹍秈︽trackingㄣ
break;
}
}
}
//рhue锣ΘRGB
CvScalar hsv2rgb( float hue )
{
int rgb[3] p sector;
static const int sector_data[][3]=
{{021} {120} {102} {201} {210} {012}};
hue *= 0.033333333333333333333333333333333f;
sector = cvFloor(hue);
p = cvRound(255*(hue - sector));
p ^= sector & 1 ? 255 : 0;
rgb[sector_data[sector][0]] = 255;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 23714816 2007-04-15 19:49 tracking\1.avi
文件 871 2007-04-15 19:48 tracking\Backup\test.sln
..A..H. 11776 2007-08-29 01:43 tracking\Backup\test.v12.suo
文件 802864 2007-04-15 19:48 tracking\cv097.dll
文件 1040436 2007-04-15 19:48 tracking\cxcore097.dll
文件 401461 2007-04-15 19:48 tracking\highgui097.dll
文件 1681 2015-11-29 23:04 tracking\Release\test.log
文件 462953 2015-11-29 23:04 tracking\Release\test.obj
文件 622 2015-11-29 23:04 tracking\Release\test.tlog\cl.command.1.tlog
文件 18708 2015-11-29 23:04 tracking\Release\test.tlog\CL.read.1.tlog
文件 338 2015-11-29 23:04 tracking\Release\test.tlog\CL.write.1.tlog
文件 2 2015-11-29 23:04 tracking\Release\test.tlog\li
文件 2 2015-11-29 23:04 tracking\Release\test.tlog\li
文件 2 2015-11-29 23:04 tracking\Release\test.tlog\li
文件 175 2015-11-29 23:04 tracking\Release\test.tlog\test.lastbuildstate
文件 0 2015-11-29 23:04 tracking\Release\test.tlog\unsuccessfulbuild
文件 1003520 2015-11-29 23:04 tracking\Release\vc120.pdb
文件 375296 2007-04-15 19:48 tracking\report.doc
文件 15872 2007-04-15 19:48 tracking\report.ppt
文件 7678 2007-04-15 19:48 tracking\test.cpp
文件 7015424 2007-08-29 01:43 tracking\test.ncb
文件 15794176 2015-11-29 23:33 tracking\test.sdf
文件 952 2015-11-21 22:57 tracking\test.sln
文件 901 2007-04-15 19:48 tracking\test.sln.old
..A..H. 11776 2007-08-29 01:43 tracking\test.suo
文件 8192 2007-04-15 19:48 tracking\test.suo.old
..A..H. 27136 2015-11-29 23:33 tracking\test.v12.suo
文件 3880 2007-04-15 19:48 tracking\test.vcproj
文件 3137 2007-04-15 19:48 tracking\test.vcproj.7.10.old
文件 1425 2007-04-15 19:48 tracking\test.vcproj.J-2GXJ5FA34JEJB.Jero.user
............此处省略15个文件信息
- 上一篇:ssm框架登录增删改查
- 下一篇:ArcGIS插件;加载高德、OSM和谷歌等地图
评论
共有 条评论