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

  • 大小: 560KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-16
  • 語言: 其他
  • 標簽: OpenCV??

資源簡介

在視頻交通監控系統中,圖像采集設備固定于道路、橋梁或收費站的上方, 對下方的場景進行拍攝,一般來說背景在短時間內不會變動,可以看成是靜止背 景下的運動車輛目標的檢測。

資源截圖

代碼片段和文件信息

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

//?various?tracking?parameters?(in?seconds)
const?double?MHI_DURATION?=?0.5;
const?double?MAX_TIME_DELTA?=?0.5;
const?double?MIN_TIME_DELTA?=?0.05;
//?用于運動檢測的循環幀數,與機器速度以及FPS設置有關
const?int?N?=?2;

//?ring?image?buffer
IplImage?**buf?=?0;
int?last?=?0;

//?temporary?images
IplImage?*mhi?=?0;?//?MHI:?motion?history?image
IplImage?*orient?=?0;?//?orientation
IplImage?*mask?=?0;?//?valid?orientation?mask
IplImage?*segmask?=?0;?//?motion?segmentation?map
CvMemStorage*?storage?=?0;?//?temporary?storage

//?parameters:
//??img?-?input?video?frame
//??dst?-?resultant?motion?picture
//??args?-?optional?parameters
void??update_mhi(?IplImage*?img?IplImage*?dst?int?diff_threshold?)
{
????double?timestamp?=?clock()/1000.;?//?get?current?time?in?seconds
????CvSize?size?=?cvSize(img->widthimg->height);?//?get?current?frame?size
????int?i?idx1?=?last?idx2;
????IplImage*?silh;
????CvSeq*?seq;
????CvRect?comp_rect;
????double?count;
????double?angle;
????CvPoint?center;
????double?magnitude;??????????
????CvScalar?color;

????//?allocate?images?at?the?beginning?or
????//?reallocate?them?if?the?frame?size?is?changed
????if(?!mhi?||?mhi->width?!=?size.width?||?mhi->height?!=?size.height?)?
????{
????????if(?buf?==?0?)?
????????{
????????????buf?=?(IplImage**)malloc(N*sizeof(buf[0]));
????????????memset(?buf?0?N*sizeof(buf[0]));
????????}
????????
????????for(?i?=?0;?i?????????{
????????????cvReleaseImage(?&buf[i]?);
????????????buf[i]?=?cvCreateImage(?size?IPL_DEPTH_8U?1?);
????????????cvZero(?buf[i]?);
????????}
????????cvReleaseImage(?&mhi?);
????????cvReleaseImage(?&orient?);
????????cvReleaseImage(?&segmask?);
????????cvReleaseImage(?&mask?);
????????
????????mhi?=?cvCreateImage(?size?IPL_DEPTH_32F?1?);
????????cvZero(?mhi?);?//?clear?MHI?at?the?beginning
????????orient?=?cvCreateImage(?size?IPL_DEPTH_32F?1?);
????????segmask?=?cvCreateImage(?size?IPL_DEPTH_32F?1?);
????????mask?=?cvCreateImage(?size?IPL_DEPTH_8U?1?);
????}

????cvCvtColor(?img?buf[last]?CV_BGR2GRAY?);?//?convert?frame?to?grayscale

????idx2?=?(last?+?1)?%?N;?//?index?of?(last?-?(N-1))th?frame
????last?=?idx2;

????silh?=?buf[idx2];
????//?相鄰兩幀的差
????cvAbsDiff(?buf[idx1]?buf[idx2]?silh?);?//?get?difference?between?frames
????
????//?對差圖像做二值化
????cvThreshold(?silh?silh?diff_threshold?1?CV_THRESH_BINARY?);?//?and?threshold?it
????cvUpdateMotionHistory(?silh?mhi?timestamp?MHI_DURATION?);?//?update?MHI

????//?convert?MHI?to?blue?8u?image
????//?cvCvtScale的第四個參數?shift?=?(MHI_DURATION?-?timestamp)*255./MHI_DURATION
????//?控制幀差的消失速率
cvCvtScale(?mhi?mask?255./MHI_DURATION
?(MHI_DURATION?-?timestamp)*255./MHI_DURATION?);

????cvZero(?dst?);
????cvCvtPlaneToPix(mask?0?0?0?dst?);??//?BGR0?->?dist?:?convert?to?BLUE?image

????//?計算運動的梯度方向以及正確的方向掩模mask
????//?Filter?size?=?3
cvCalcMotionGradient(?mhi?mask?orient?
MAX_TIME_DELTA?MIN_TIME_DELTA?3

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

?????文件???????3768??2010-05-12?10:24??例5-21\Debug\BuildLog.htm

?????文件?????204855??2010-05-08?19:34??例5-21\Debug\motempl.exe

?????文件???????2048??2010-05-12?10:18??例5-21\Debug\motempl.exe.embed.manifest

?????文件?????238404??2010-05-08?19:34??例5-21\Debug\motempl.ilk

?????文件??????41984??2010-05-08?19:34??例5-21\Debug\vc60.idb

?????文件??????77824??2010-05-08?19:34??例5-21\Debug\vc60.pdb

?????文件??????19456??2010-05-12?10:24??例5-21\Debug\vc80.idb

?????文件??????36864??2010-05-12?10:24??例5-21\Debug\vc80.pdb

?????文件????????135??2007-02-24?15:18??例5-21\Makefile

?????文件???????6613??2007-02-24?15:17??例5-21\motempl.c

?????文件???????4160??2007-03-07?20:41??例5-21\motempl.dsp

?????文件????????539??2007-03-07?20:41??例5-21\motempl.dsw

?????文件?????134144??2010-05-12?10:26??例5-21\motempl.ncb

?????文件??????53760??2010-05-08?19:35??例5-21\motempl.opt

?????文件???????1173??2010-05-08?19:34??例5-21\motempl.plg

?????文件????????878??2010-05-12?10:18??例5-21\motempl.sln

????..A..H.??????7168??2010-05-12?10:18??例5-21\motempl.suo

?????文件???????5318??2010-05-12?10:18??例5-21\motempl.vcproj

?????文件???????1427??2010-05-12?10:18??例5-21\motempl.vcproj.WWW-7F00BFE87CD.Administrator.user

?????文件?????432700??2007-02-24?15:18??例5-21\video.avi

?????目錄??????????0??2010-05-12?10:24??例5-21\Debug

?????目錄??????????0??2010-05-12?10:18??例5-21

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

??????????????1273218????????????????????22


評論

共有 條評論