人物跟踪识别


简单的人物跟踪识别,压缩包里面已经附加视频,点击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->origin1赣瓜オ翴 0玥琌オ翴  
        y = image->height - y;         //1玥рy竚 眖┕琌タ  跑Θオ0  match瓜畒夹禸

    if( select_object )                //秨﹍select_object0  ┮秈ぃㄓ  琌璶┿菲公龄  碞秈眔ㄓ  秨﹍匡roi
    {
        selection.x = MIN(x origin.x);         //菲公  オà繦跑  ┮update  程オx
        selection.y = MIN(y origin.y);         
        selection.width = selection.x + CV_IABS(x - origin.x);    //OFFSETX 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  tracking1.avi

     文件        871  2007-04-15 19:48  trackingBackup est.sln

    ..A..H.     11776  2007-08-29 01:43  trackingBackup est.v12.suo

     文件     802864  2007-04-15 19:48  trackingcv097.dll

     文件    1040436  2007-04-15 19:48  trackingcxcore097.dll

     文件     401461  2007-04-15 19:48  trackinghighgui097.dll

     文件       1681  2015-11-29 23:04  trackingRelease est.log

     文件     462953  2015-11-29 23:04  trackingRelease est.obj

     文件        622  2015-11-29 23:04  trackingRelease est.tlogcl.command.1.tlog

     文件      18708  2015-11-29 23:04  trackingRelease est.tlogCL.read.1.tlog

     文件        338  2015-11-29 23:04  trackingRelease est.tlogCL.write.1.tlog

     文件          2  2015-11-29 23:04  trackingRelease est.tloglink.command.1.tlog

     文件          2  2015-11-29 23:04  trackingRelease est.tloglink.read.1.tlog

     文件          2  2015-11-29 23:04  trackingRelease est.tloglink.write.1.tlog

     文件        175  2015-11-29 23:04  trackingRelease est.tlog est.lastbuildstate

     文件          0  2015-11-29 23:04  trackingRelease est.tlogunsuccessfulbuild

     文件    1003520  2015-11-29 23:04  trackingReleasevc120.pdb

     文件     375296  2007-04-15 19:48  tracking
eport.doc

     文件      15872  2007-04-15 19:48  tracking
eport.ppt

     文件       7678  2007-04-15 19:48  tracking est.cpp

     文件    7015424  2007-08-29 01:43  tracking est.ncb

     文件   15794176  2015-11-29 23:33  tracking est.sdf

     文件        952  2015-11-21 22:57  tracking est.sln

     文件        901  2007-04-15 19:48  tracking est.sln.old

    ..A..H.     11776  2007-08-29 01:43  tracking est.suo

     文件       8192  2007-04-15 19:48  tracking est.suo.old

    ..A..H.     27136  2015-11-29 23:33  tracking est.v12.suo

     文件       3880  2007-04-15 19:48  tracking est.vcproj

     文件       3137  2007-04-15 19:48  tracking est.vcproj.7.10.old

     文件       1425  2007-04-15 19:48  tracking est.vcproj.J-2GXJ5FA34JEJB.Jero.user

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

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)