资源简介

基于camshift均值漂移算法, kalman卡尔曼滤波算法及LBP特征的目标跟随算法,配置完成 opencv路径即可运行。LBP特征跟踪非常的稳定,对于颜色差别不大的区域也能流程跟随,比如跟踪手能够平滑的经过脸部区域而不漂移。工程为集中集中算法融合优化,非常适合学习及工程实践。

资源截图

代码片段和文件信息

/****
* TJ Wilkason 2009 science fair project to track video objects
* Goal: Track video objects as the move through occlusions
*/
#include “camshift.h“
#include “clsKalman.h“
#include “tmplDetector.h“
IplImage *imgProcess = 0 
  *imgHSV = 0 *imgHSVPlanes[3] *imgCurrentMask=0*lbpImage=0 
  *imgTargetMask = 0 *imgBackProjection = 0 *imgHistRaw=0*imgLBPTarget=0
  *imgLBPBG=0 *imgHistTarget = 0*imgHistBG=0 *imgContour=0 *lbpGray=0;
CvHistogram *histTarget = 0*histTargetOrig = 0 *histBG=0 *histCandidate = 0 *histBGtemp=0;
// Program Settings
int defFlip= 0;
int defCapture=0;
int defOcclusion=0;                              // 0 = None 1 = Wood Track 2 = Cement Track
int defTrackBoxMin = 10;
int defUseKalman=1;
int defUseTemplate=1;
int defLogfile=0;
int defDebugGraphics=1;
double defMinArea=2000.0;                        // Any smaller boxTrack data is invalid
double winFactor =2.0;
double fps=30.0;
double GF = 1.0;                                // Increase search window size
double defMinAreaFactor = 0.5;
TrackType TrackMode = NOTRACK;
// Mode Settings
int modeBackProjection = 0;
int modeSelectobject = 0;
int modeShowHistogram = 1;
// Histogram
#define MAXHUE 180
#define LBPBINS 36
#define LBPSIZE 36  //max possible values of LBP
#define LBPOS 5     //default offset for LBP operation (4/5 works for lbp36)
int histSize[] = {32 16 LBPBINS};
float hranges_arr[] = {0MAXHUE};
float sranges_arr[] = {0255};
float vranges_arr[] = {0LBPSIZE-1};
#if DEPTH == 1
float* hranges[] = {hranges_arr};
#elif DEPTH ==2
float* hranges[] = {hranges_arr sranges_arr};
#else
float* hranges[] = {hranges_arr sranges_arr vranges_arr};
#endif


int adjVmin = 10 adjVmax = 256 adjSmin = 100 adjSmax=MAXHUE;
CvFont font;
CvScalar fontColor = CV_RGB(000);
CvPoint ptOrigin;
CvRect rectSel;
CvRect rectCamSW;
CvBox2D boxTrack;
CvConnectedComp compTrack;
//
// Automatically adjust the limits for the Sat/Lum
//
void adjustLimits(IplImage *imgHSV);
void initHistogram(CvHistogram *histT CvHistogram *histBIplImage **imgHSVPlanes IplImage *imgTMCvRect useRectSeldouble threshold);
void on_mouse( int event int x int y int flags void* param );
void radialGradient(IplImage *image);
float framesPerSecond(CvCapture *capture);


float timeNow=0;
int waitMS=0;
int main( int argc char** argv )
{
   results myResults;
   myResults.camCycles=0;
   myResults.totframes=0;
   myResults.cumKalamError=0.0;
   myResults.Occluded=0;
   cvInitFont(&fontCV_FONT_VECTOR0 0.6 0.6 0.0 2);
   CvCapture* capture = 0;
   double skMeasurementNoise =30.0 /2.0;
   double acqThreshold = -0.25;
   char imgText[255];
   int wait=20;
   double histCorr=0;   // histogram correlation
   CvScalar avgHSV stdHSV;
   int useOffset=0;
   /****
   Parameters:
   1 Input File
   2 Log File
   3 Process Noise
   4 Measurement Noise
   5 wait period < 0 = none
   6 nthframe (frame skipping)
   *

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件    2752512  2016-11-15 17:41  camShiftKalmanLBP-VS2010\ipch\opentest-4710cc43\opentest-526e489e.ipch

     文件       3792  2016-11-15 11:31  camShiftKalmanLBP-VS2010\opentest\camshift.h

     文件      39062  2010-04-09 08:13  camShiftKalmanLBP-VS2010\opentest\camshiftKalman.cpp

     文件      12035  2016-11-15 11:23  camShiftKalmanLBP-VS2010\opentest\camshiftutils.cpp

     文件       3968  2016-11-15 11:23  camShiftKalmanLBP-VS2010\opentest\clsKalman.cpp

     文件        744  2010-02-13 18:44  camShiftKalmanLBP-VS2010\opentest\clsKalman.h

     文件       5301  2016-11-15 11:23  camShiftKalmanLBP-VS2010\opentest\condensation.cpp

     文件       1065  2010-02-14 12:36  camShiftKalmanLBP-VS2010\opentest\Coord.h

     文件       5143  2016-11-15 13:42  camShiftKalmanLBP-VS2010\opentest\FindFile.cpp

     文件       2296  2016-11-15 13:42  camShiftKalmanLBP-VS2010\opentest\FindFile.h

     文件       9365  2016-11-15 11:23  camShiftKalmanLBP-VS2010\opentest\Histogram.cpp

     文件       6647  2016-11-15 11:23  camShiftKalmanLBP-VS2010\opentest\LBP.cpp

     文件      39072  2016-11-15 13:39  camShiftKalmanLBP-VS2010\opentest\opentest.cpp

     文件       5661  2016-11-15 13:41  camShiftKalmanLBP-VS2010\opentest\opentest.vcxproj

     文件       2864  2016-11-15 11:21  camShiftKalmanLBP-VS2010\opentest\opentest.vcxproj.filters

     文件        143  2015-11-02 15:16  camShiftKalmanLBP-VS2010\opentest\opentest.vcxproj.user

     文件       1560  2015-11-02 15:16  camShiftKalmanLBP-VS2010\opentest\ReadMe.txt

     文件       1251  2010-02-14 19:42  camShiftKalmanLBP-VS2010\opentest\SampleStat.h

     文件       3133  2009-10-18 14:55  camShiftKalmanLBP-VS2010\opentest\SDL.h

     文件        213  2015-11-02 15:16  camShiftKalmanLBP-VS2010\opentest\stdafx.cpp

     文件        233  2015-11-02 15:16  camShiftKalmanLBP-VS2010\opentest\stdafx.h

     文件        236  2015-11-02 15:16  camShiftKalmanLBP-VS2010\opentest\targetver.h

     文件       2960  2016-11-15 11:23  camShiftKalmanLBP-VS2010\opentest\tmplDetector.cpp

     文件        524  2010-02-13 17:42  camShiftKalmanLBP-VS2010\opentest\tmplDetector.h

     文件       2008  2016-11-15 11:23  camShiftKalmanLBP-VS2010\opentest\VAR.cpp

     文件       5672  2010-01-31 11:29  camShiftKalmanLBP-VS2010\opentest\vidCapture.avi

     文件       4852  2016-11-15 11:23  camShiftKalmanLBP-VS2010\opentest\wildcard.cpp

     文件       1803  2002-11-29 13:56  camShiftKalmanLBP-VS2010\opentest\wildcard.h

     文件        891  2015-11-02 15:16  camShiftKalmanLBP-VS2010\opentest.sln

    ..A..H.     42496  2016-11-15 20:05  camShiftKalmanLBP-VS2010\opentest.suo

............此处省略7个文件信息

评论

共有 条评论