资源简介
绝对的可运行,配合usb摄像头,选定目标即可对目标进行实时跟踪,效果很好。
代码片段和文件信息
#include “CompressiveTracker.h“
#include
#include
using namespace cv;
using namespace std;
//------------------------------------------------
CompressiveTracker::CompressiveTracker(void)
{
featureMinNumRect = 2;
featureMaxNumRect = 4; // number of rectangle from 2 to 4
featureNum = 50; // number of all weaker classifiers i.efeature pool
rOuterPositive = 4; // radical scope of positive samples
rSearchWindow = 25; // size of search window
muPositive = vector(featureNum 0.0f);
muNegative = vector(featureNum 0.0f);
sigmaPositive = vector(featureNum 1.0f);
sigmaNegative = vector(featureNum 1.0f);
learnRate = 0.85f; // Learning rate parameter
}
CompressiveTracker::~CompressiveTracker(void)
{
}
//haar算法检测器
void CompressiveTracker::HaarFeature(Rect& _objectBox int _numFeature)
/*Description: 计算haar特征
参数:
-_objectBox: [x y width height] object rectangle 目标矩形框
-_numFeature: total number of features.The default is 50.
*/
{
features = vector>(_numFeature vector());
featuresWeight = vector>(_numFeature vector());
int numRect;
Rect rectTemp;
float weightTemp;
for (int i=0; i<_numFeature; i++)
{
numRect = cvFloor(rng.uniform((double)featureMinNumRect (double)featureMaxNumRect));
//int c = 1;
for (int j=0; j {
rectTemp.x = cvFloor(rng.uniform(0.0 (double)(_objectBox.width - 3)));
rectTemp.y = cvFloor(rng.uniform(0.0 (double)(_objectBox.height - 3)));
rectTemp.width = cvCeil(rng.uniform(0.0 (double)(_objectBox.width - rectTemp.x - 2)));
rectTemp.height = cvCeil(rng.uniform(0.0 (double)(_objectBox.height - rectTemp.y - 2)));
features[i].push_back(rectTemp);
weightTemp = (float)pow(-1.0 cvFloor(rng.uniform(0.0 2.0))) / sqrt(float(numRect));
//weightTemp = (float)pow(-1.0 c);
featuresWeight[i].push_back(weightTemp);
}
}
}
void CompressiveTracker::sampleRect(Mat& _image Rect& _objectBox float _rInner float _rOuter int _maxSampleNum vector& _sampleBox)
/* Description: compute the coordinate of positive and negative sample image templates
Arguments:
-_image: processing frame
-_objectBox: recent object position
-_rInner: inner sampling radius
-_rOuter: Outer sampling radius
-_maxSampleNum: maximal number of sampled images
-_sampleBox: Storing the rectangle coordinates of the sampled images.
*/
{
int rowsz = _image.rows - _objectBox.height - 1;
int colsz = _image.cols - _objectBox.width - 1;
float inradsq = _rInner*_rInner;
float outradsq = _rOuter*_rOuter;
int dist;
int minrow = max(0(int)_objectBox.y-(int)_rInner);
int maxrow = min((int)rowsz-1(int)_objectBox.y+(int)_rInner);
int mincol = max(0(int)_objectBox.x-(int)_rInner);
int maxcol = min((int)colsz-1(int)_objectBox.x+(int)_
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 9198 2012-05-01 14:45 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\CompressiveTracker.cpp
文件 2163 2012-08-23 17:59 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\CompressiveTracker.h
文件 4005 2012-08-07 09:59 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\CompressiveTracking.vcproj
文件 1449 2012-08-24 10:47 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\CompressiveTracking.vcproj.HP98402794308.Administrator.user
文件 1427 2012-08-24 13:46 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\CompressiveTracking.vcproj.PC-201008102047.Administrator.user
文件 4540 2012-05-01 21:21 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\CompressiveTracking.vcxproj
文件 1168 2012-04-27 11:07 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\CompressiveTracking.vcxproj.filters
文件 143 2012-04-27 11:06 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\CompressiveTracking.vcxproj.user
文件 962560 2011-12-04 05:39 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\david.mpg
文件 12 2012-08-07 14:56 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\init.txt
文件 1454 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\cl.command.1.tlog
文件 25986 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\CL.read.1.tlog
文件 1442 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\CL.write.1.tlog
文件 1136877 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\CompressiveTracker.obj
文件 381 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\CompressiveTracking.exe.intermediate.manifest
文件 87 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\CompressiveTracking.lastbuildstate
文件 3820 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\CompressiveTracking.log
文件 1902 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\li
文件 3234 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\li
文件 956 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\li
文件 616 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\mt.command.1.tlog
文件 1044 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\mt.read.1.tlog
文件 412 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\mt.write.1.tlog
文件 1015000 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\RunTracker.obj
文件 479232 2012-05-05 09:40 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\Release\vc100.pdb
文件 4334 2012-05-05 09:39 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking\RunTracker.cpp
文件 9440256 2012-08-24 13:46 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking.ncb
文件 11685888 2012-05-05 13:19 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking.sdf
文件 924 2012-04-27 11:07 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking.sln
文件 923 2012-08-24 10:43 压缩TLD追踪方法\CTFromCam_v0\CompressiveTracking.sln.old
............此处省略23个文件信息
评论
共有 条评论