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

  • 大小: 12.69MB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2023-07-08
  • 語言: 其他
  • 標簽: opencv??幀差法??

資源簡介

幀差法實現(xiàn)前景背景分離,來自于BGSLibrary,對于靜態(tài)的背景效果很好!

資源截圖

代碼片段和文件信息

#include?
#include?

using?namespace?std;
using?namespace?cv;

//our?sensitivity?value?to?be?used?in?the?absdiff()?function
const?static?int?SENSITIVITY_VALUE?=?20;
//size?of?blur?used?to?smooth?the?intensity?image?output?from?absdiff()?function
const?static?int?BLUR_SIZE?=?10;
//we‘ll?have?just?one?object?to?search?for
//and?keep?track?of?its?position.
int?theobject[2]?=?{00};
//bounding?rectangle?of?the?object?we?will?use?the?center?of?this?as?its?position.
Rect?objectBoundingRectangle?=?Rect(0000);


//int?to?string?helper?function
string?intToString(int?number){

//this?function?has?a?number?input?and?string?output
std::stringstream?ss;
ss?< return?ss.str();
}

int?main(){

//these?two?can?be?toggled?by?pressing?‘d‘?or?‘t‘
bool?debugMode?=?true;
//pause?and?resume?code
bool?pause?=?false;
//set?up?the?matrices?that?we?will?need
//the?two?frames?we?will?be?comparing
Mat?frame1frame2;
//their?grayscale?images?(needed?for?absdiff()?function)
Mat?grayImage1grayImage2;
//resulting?difference?image
Mat?differenceImage;
//thresholded?difference?image?(for?use?in?findContours()?function)
Mat?thresholdImage;
//video?capture?object.
VideoCapture?capture;

while(1){

//we?can?loop?the?video?by?re-opening?the?capture?every?time?the?video?reaches?its?last?frame

capture.open(“video.avi“);

if(!capture.isOpened()){
cout<<“ERROR?ACQUIRING?VIDEO?FEED\n“;
getchar();
return?-1;
}

//check?if?the?video?has?reach?its?last?frame.
//we?add?‘-1‘?because?we?are?reading?two?frames?from?the?video?at?a?time.
//if?this?is?not?included?we?get?a?memory?error!
while(capture.get(CV_CAP_PROP_POS_frameS)ame_COUNT)-1){

//read?first?frame
capture.read(frame1);
//convert?frame1?to?gray?scale?for?frame?differencing
cv::cvtColor(frame1grayImage1COLOR_BGR2GRAY);
//copy?second?frame
capture.read(frame2);
//convert?frame2?to?gray?scale?for?frame?differencing
cv::cvtColor(frame2grayImage2COLOR_BGR2GRAY);
//perform?frame?differencing?with?the?sequential?images.?This?will?output?an?“intensity?image“
//do?not?confuse?this?with?a?threshold?image?we?will?need?to?perform?thresholding?afterwards.
cv::absdiff(grayImage1grayImage2differenceImage);
//threshold?intensity?image?at?a?given?sensitivity?value
cv::threshold(differenceImagethresholdImageSENSITIVITY_VALUE255THRESH_BINARY);
if(debugMode==true){
//show?the?difference?image?and?threshold?image
cv::imshow(“Difference?Image“differenceImage);
cv::imshow(“Threshold?Image“?thresholdImage);
}else{
//if?not?in?debug?mode?destroy?the?windows?so?we?don‘t?see?them?anymore
cv::destroyWindow(“Difference?Image“);
cv::destroyWindow(“Threshold?Image“);
}
//blur?the?image?to?get?rid?of?the?noise.?This?will?output?an?intensity?image
cv::blur(thresholdImagethresho

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-10-03?21:05??frame_Difference_1\
?????目錄???????????0??2014-10-03?20:57??frame_Difference_1\Debug\
?????目錄???????????0??2014-10-03?20:56??frame_Difference_1\frame_Difference_1\
?????文件????39845888??2014-10-03?21:05??frame_Difference_1\frame_Difference_1.sdf
?????文件?????????921??2014-10-03?20:52??frame_Difference_1\frame_Difference_1.sln
?????文件???????20480??2014-10-03?21:05??frame_Difference_1\frame_Difference_1.v11.suo
?????目錄???????????0??2014-10-03?20:57??frame_Difference_1\frame_Difference_1\Debug\
?????文件?????????762??2014-10-03?20:57??frame_Difference_1\frame_Difference_1\Debug\cl.command.1.tlog
?????文件???????18994??2014-10-03?20:57??frame_Difference_1\frame_Difference_1\Debug\CL.read.1.tlog
?????文件?????????374??2014-10-03?20:57??frame_Difference_1\frame_Difference_1\Debug\CL.write.1.tlog
?????文件????????2072??2014-10-03?20:57??frame_Difference_1\frame_Difference_1\Debug\frame_Difference_1.Build.CppClean.log
?????文件??????????93??2014-10-03?20:57??frame_Difference_1\frame_Difference_1\Debug\frame_Difference_1.lastbuildstate
?????文件????????1252??2014-10-03?20:57??frame_Difference_1\frame_Difference_1\Debug\frame_Difference_1.log
?????文件???????????0??2014-10-03?20:57??frame_Difference_1\frame_Difference_1\Debug\frame_Difference_1.unsuccessfulbuild
?????文件??????363520??2014-10-03?20:57??frame_Difference_1\frame_Difference_1\Debug\vc110.idb
?????文件??????561152??2014-10-03?20:57??frame_Difference_1\frame_Difference_1\Debug\vc110.pdb
?????文件????????4018??2014-10-03?20:54??frame_Difference_1\frame_Difference_1\frame_Difference_1.vcxproj
?????文件?????????942??2014-10-03?20:54??frame_Difference_1\frame_Difference_1\frame_Difference_1.vcxproj.filters
?????文件????????3967??2014-10-03?20:58??frame_Difference_1\frame_Difference_1\main.cpp
?????文件?????1049784??2012-02-02?09:30??frame_Difference_1\frame_Difference_1\video.avi

評論

共有 條評論