• 大小: 13.04MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-07-02
  • 语言: 其他
  • 标签: 跟踪识别  

资源简介

简单的人物跟踪识别,压缩包里面已经附加视频,点击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  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\link.command.1.tlog

     文件          2  2015-11-29 23:04  tracking\Release\test.tlog\link.read.1.tlog

     文件          2  2015-11-29 23:04  tracking\Release\test.tlog\link.write.1.tlog

     文件        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个文件信息

评论

共有 条评论

相关资源