今天仔细研究了一下差分法求运动的轮廓,简单用程序实现了一下,结果如下,差分法比较容易获得运动的轮廓,对于不运动的身体部分则不会显示,这样的好处是可以得到需要关注的运动部分,不运动的则不关心,但是如果需要得到整个人体的轮廓,该如何呢?我试着用程序记录前4帧的数据,然后叠加出来显示,看来效果不是很好. 还要继续考虑...
#ifdef _ch_#pragma package <opencv>#endif 【程序编程相关:使用Visual C++实现OLE剪贴板】
关键部分的代码如下:main.cpp 【推荐阅读:VC6中用DOM遍历网页中的元素】
// various tracking parameters (in seconds)const double mhi_duration = 1;const double max_time_delta = 0.5;const double min_time_delta = 0.05;// number of cyclic frame buffer used for motion detection// (should, probably, depend on fps)const int n = 4; 【扩展信息:VC++中 ListCtrl 树控件介】
#ifndef _eic// motion templates sample code#include "cv.h"#include "highgui.h"#include <time.h>#include <math.h>#include <ctype.h>#include <stdio.h>#endif
// ring image bufferiplimage **buf = 0;int last = 0;
// temporary imagesiplimage *mhi = 0; // mhiiplimage *orient = 0; // orientationiplimage *mask = 0; // valid orientation maskiplimage *segmask = 0; // motion segmentation mapcvmemstorage* storage = 0; // temporary storage
iplimage* abs_image = 0;iplimage* add_abs_image = 0;iplimage* abs_images[3];
iplimage* grey =0;iplimage* pre_grey = 0;iplimage* dst = 0; cvseq* contour = 0;
int test( iplimage* src,iplimage* pre_src );
int main(int argc, char** argv){ //iplimage* motion = 0; cvcapture* capture = 0; iplimage* pre_image = 0; iplimage* image = 0; int frame_count =0;
... 下一页