资源简介

本科毕业设计,勉强也算个优。室内目标跟踪的项目,先是包括光照补偿和阴影去除的图像处理,再就是稍微修改了下码书模板和运动模板,内含毕设期间提交的代码、文档以及演示。需要的话可以参考下。 VisualC++ 6.0; OpenCV 1.0.

资源截图

代码片段和文件信息

#include “background.h“

IplImage *IavgF[NUM_CAMERAS]*IdiffF[NUM_CAMERAS] *IprevF[NUM_CAMERAS] *IhiF[NUM_CAMERAS] *IlowF[NUM_CAMERAS];
IplImage *Iscratch*Iscratch2*Igray1*Igray2*Igray3*Imaskt;
IplImage *Ilow1[NUM_CAMERAS]*Ilow2[NUM_CAMERAS]*Ilow3[NUM_CAMERAS]*Ihi1[NUM_CAMERAS]*Ihi2[NUM_CAMERAS]*Ihi3[NUM_CAMERAS];

float Icount[NUM_CAMERAS];

void AllocateImages(IplImage *I)
{
for(int i = 0; i {
IavgF[i] = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 3 );
IdiffF[i] = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 3 );
IprevF[i] = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 3 );
IhiF[i] = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 3 );
IlowF[i] = cvCreateImage(cvGetSize(I) IPL_DEPTH_32F 3 );
Ilow1[i] = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 1 );
Ilow2[i] = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 1 );
Ilow3[i] = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 1 );
Ihi1[i] = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 1 );
Ihi2[i] = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 1 );
Ihi3[i] = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 1 );
cvZero(IavgF[i]  );
cvZero(IdiffF[i] );
cvZero(IprevF[i] );
cvZero(IhiF[i]   );
cvZero(IlowF[i]  );
Icount[i] = 0.00001;
}
Iscratch = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 3 );
Iscratch2 = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 3 );
Igray1 = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 1 );
Igray2 = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 1 );
Igray3 = cvCreateImage( cvGetSize(I) IPL_DEPTH_32F 1 );
Imaskt = cvCreateImage( cvGetSize(I) IPL_DEPTH_8U 1 );
cvZero(Iscratch);
cvZero(Iscratch2 );
}

void DeallocateImages()
{
for(int i=0; i {
cvReleaseImage(&IavgF[i]);
cvReleaseImage(&IdiffF[i] );
cvReleaseImage(&IprevF[i] );
cvReleaseImage(&IhiF[i] );
cvReleaseImage(&IlowF[i] );
cvReleaseImage(&Ilow1[i]  );
cvReleaseImage(&Ilow2[i]  );
cvReleaseImage(&Ilow3[i]  );
cvReleaseImage(&Ihi1[i]   );
cvReleaseImage(&Ihi2[i]   );
cvReleaseImage(&Ihi3[i]  );
}
cvReleaseImage(&Iscratch);
cvReleaseImage(&Iscratch2);
cvReleaseImage(&Igray1  );
cvReleaseImage(&Igray2 );
cvReleaseImage(&Igray3 );
cvReleaseImage(&Imaskt);
}

void accumulateBackground(IplImage *I int number)
{
static int first = 1;
cvCvtScale(IIscratch10);
if (!first)
{
cvAcc(IscratchIavgF[number]);
cvAbsDiff(IscratchIprevF[number]Iscratch2);
cvAcc(Iscratch2IdiffF[number]);
Icount[number] += 1.0;
}
first = 0;
cvCopy(IscratchIprevF[number]);
}

void scaleHigh(float scale int num)
{
cvConvertScale(IdiffF[num]Iscratchscale);
cvAdd(IscratchIavgF[num]IhiF[num]);
cvCvtPixToPlane( IhiF[num] Ihi1[num]Ihi2[num]Ihi3[num] 0 );
}

void scaleLow(float scale int num)
{
cvConvertScale(IdiffF[num]Iscratchscale);
cvSub(IavgF[num]IscratchIlowF[num]);
cvCvtPixToPlane( IlowF[num] Ilow1[num]Ilow2[num]Ilow3[num]

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-03-23 18:16  cbMotion\
     文件        3727  2011-05-26 16:15  cbMotion\background.cpp
     文件         521  2011-05-12 21:20  cbMotion\background.h
     文件        4458  2011-05-13 07:58  cbMotion\cbMotion.dsp
     文件         541  2011-05-13 07:56  cbMotion\cbMotion.dsw
     文件      107520  2011-12-10 20:45  cbMotion\cbMotion.ncb
     文件      571904  2011-12-10 20:45  cbMotion\cbMotion.opt
     文件         250  2011-05-28 01:33  cbMotion\cbMotion.plg
     文件        5758  2011-05-14 08:56  cbMotion\codebook.cpp
     文件         852  2011-05-27 03:31  cbMotion\codebook.h
     目录           0  2012-03-23 18:08  cbMotion\Debug\
     文件       24093  2011-05-26 23:44  cbMotion\Debug\background.obj
     文件           0  2011-05-26 11:06  cbMotion\Debug\background.sbr
     文件     2147328  2011-05-26 11:06  cbMotion\Debug\cbMotion.bsc
     文件      184401  2011-05-28 01:33  cbMotion\Debug\cbMotion.exe
     文件      411076  2011-05-28 01:33  cbMotion\Debug\cbMotion.ilk
     文件     4133636  2011-05-27 03:35  cbMotion\Debug\cbMotion.pch
     文件      517120  2011-05-28 01:33  cbMotion\Debug\cbMotion.pdb
     文件       24547  2011-05-27 03:35  cbMotion\Debug\codebook.obj
     文件           0  2011-05-26 11:06  cbMotion\Debug\codebook.sbr
     文件       30130  2011-05-28 01:33  cbMotion\Debug\motionDetect.obj
     文件           0  2011-05-26 11:06  cbMotion\Debug\motionDetect.sbr
     文件      181248  2011-05-28 01:33  cbMotion\Debug\vc60.idb
     文件      110592  2011-05-28 01:33  cbMotion\Debug\vc60.pdb
     文件       10193  2011-05-28 01:33  cbMotion\motionDetect.cpp
     文件     3271680  2012-03-23 18:13  基于OpenCV的室内运动目标检测方法.ppt
     目录           0  2012-03-23 18:16  档案\
     文件       32768  2012-03-23 18:14  档案\任务.doc
     文件       53760  2012-03-23 18:13  档案\开题.doc
     文件       35328  2012-03-23 18:14  档案\课题.doc
     目录           0  2012-03-23 18:16  翻译\
............此处省略2个文件信息

评论

共有 条评论

相关资源