91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-17
  • 語言: 其他
  • 標簽: opencv??摔倒檢測??

資源簡介

利用opencv,對簡單的背景情況下的人體運動進行摔倒檢測,當運動的人摔倒時,記錄摔倒幀。

資源截圖

代碼片段和文件信息

#include?“cv.h“
#include?“cvaux.h“
#include?“highgui.h“
#include?
#include?

void?play(CvCapture*?captureint?startint?end){???//讀取視頻片段的方法
???IplImage*?frame?=NULL;
???cvSetCaptureProperty(capture?CV_CAP_PROP_POS_frameS?start);
???cvNamedWindow(“Fragment“0);
????while?(start<=end)??
??{??
????start++;
???
????frame?=?cvQueryframe(capture);??
????if?(!frame)???
??????break;??
??
????cvShowImage(“Fragment“?frame);??
????cvWaitKey(30);???????

????
??}????

}

int?main(int?argc?char**?argv)
{

????/*?Start?capturing?*/
????CvCapture*?capture?=?0;
????CvMemStorage*?storage=?cvCreateMemStorage(0);
????CvSeq*?contour=?0;
????IplImage*?pFrImg?=?NULL;
????CvFont?font;
????int?nFrmNum?=?0;
????int?totalFrm?=?0;
????int?select;?
????cvInitFont(?&font?CV_FONT_VECTOR01?1?0?1?8);
????if(?argc?==?1?||?(argc?==?2?&&?strlen(argv[1])?==?1?&&?isdigit(argv[1][0])))?
????????capture?=?cvCaptureFromCAM(?argc?==?2???argv[1][0]?-?‘0‘?:?0?);
????else?if(?argc?==?2?)
????????capture?=?cvCaptureFromAVI(?argv[1]?);

????if(?!capture?)
????{
????????fprintf(stderr“Could?not?initialize...\n“);
????????return?-1;
????}

????/*?Capture?1?video?frame?for?initialization?*/
????IplImage*?videoframe?=?NULL;
????videoframe?=?cvQueryframe(capture);??//讀取視頻
????totalFrm?=?(int)?cvGetCaptureProperty(capture?CV_CAP_PROP_frame_COUNT);?//得到視頻總幀數
????printf(“%d\n“totalFrm);
????int?FallFrm[totalFrm];
????int?FallFrms[totalFrm][2];
????int?Cframes[totalFrm][2];
????int?Fframes[totalFrm][2];
????for(int?i=0;i????{
????FallFrm[i]?=0;
????for(int?j=0;j<2;j++)
????{
????FallFrms[i][j]?=0;
????Cframes[i][j]?=0;
????Fframes[i][j]?=0;
????}
????}
????if(!videoframe)
????{
????????printf(“Bad?frame?\n“);
????????exit(0);
????}

????//?Create?windows
????cvNamedWindow(“VIDEO“?1);
????cvNamedWindow(“FG“?1);
????cvNamedWindow(“DETECT“?1);
????cvMoveWindow(“VIDEO“?30?0);??
????cvMoveWindow(“FG“?360?0);??
????cvMoveWindow(“DETECT“?690?0);?
??????
????CvGaussBGStatModelParams*?params?=?new?CvGaussBGStatModelParams;??????//高斯建模參數
????params->win_size=200;?
????params->n_gauss=5;
????params->bg_threshold=0.5;
????params->std_threshold=3.5;
????params->minArea=15;
????params->weight_init=0.05;
????params->variance_init=30;

????//?Creat?CvBGStatModel
????//?cvCreateGaussianBGModel(?IplImage*?first_frame?CvGaussBGStatModelParams*?parameters?)
????//?or
????//?cvCreateGaussianBGModel(?IplImage*?first_frame?)
????CvBGStatModel*?bgModel?=?NULL;


????while(videoframe?=?cvQueryframe(capture))???//逐幀顯示視頻
????{
????????nFrmNum++;
????????if(nFrmNum?==?1)
????????//?Grab?a?fram
????????{
???????//?videoframe?=?cvQueryframe(capture);
????????pFrImg?=?cvCreateImage(cvSize(videoframe->width?videoframe->height)??IPL_DEPTH_8U1);
???????//?cvCvtColor(?videoframepFrImg?CV_BGR2GRAY);
????????//if(?!videoframe?)
?????????//???break;
????????bgModel?=?cvCreateGaussianBGModel(videoframe?params);??//建立高斯模型
????????}else
????????//?Update?model
{
???????cvUpdateBG

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????7875??2012-01-11?17:17??gaosi\gaosi.cpp

?????目錄??????????0??2012-05-23?15:50??gaosi

-----------?---------??----------?-----??----

?????????????????7875????????????????????2


評論

共有 條評論