資源簡介
vs2013+opencv2.4.9親測可用,運(yùn)動目標(biāo)檢測效果良好,備注詳細(xì)

代碼片段和文件信息
#include?“BackgroundSubtract.h“
BackgroundSubtract::BackgroundSubtract()
{
model?=?libvibeModelNew();
}
BackgroundSubtract::~BackgroundSubtract()
{
libvibeModelFree(model);
}
void?BackgroundSubtract::init(cv::Mat?&image)
{
int32_t?width?=?image.size().width;
int32_t?height?=?image.size().height;
int32_t?stride?=?image.channels()*image.size().width;
int32_t?image_step0?=?image.step[0];
int32_t?image_step1?=?image.step[1];
uint8_t?*image_data?=?(uint8_t*)image.data;
libvibeModelInit(model?image_data?width?height?stride?image_step0?image_step1);
}
void?BackgroundSubtract::subtract(const?cv::Mat?&image?cv::Mat?&foreground)
{
uint8_t?*image_data?=?(uint8_t*)image.data;
uint8_t?*segmentation_map?=?(uint8_t*)foreground.data;
int32_t?image_step0?=?image.step[0];
int32_t?image_step1?=?image.step[1];
cv::Mat?erodeElement?=?cv::getStructuringElement(?0?cv::Size(?2?2?)?cv::Point(?-1?-1?)?);?
cv::Mat?dilateElement?=?cv::getStructuringElement(?0?cv::Size(?2?2?)?cv::Point(?-1?-1?)?);?
libvibeModelUpdate(model?image_data?segmentation_map?image_step0??image_step1);
/*cv::erode(foreground?foreground?erodeElement?cv::Point(-1?-1)?1);
cv::dilate(foreground?foreground?dilateElement?cv::Point(-1-1)?2);*/
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1260??2017-12-03?20:58??vibe\BackgroundSubtract.cpp
?????文件????????321??2017-10-27?22:09??vibe\BackgroundSubtract.h
?????文件???????2155??2017-12-03?20:41??vibe\main(datatest).cpp
?????文件???????1078??2017-11-08?19:58??vibe\main.cpp
?????文件????????368??2017-10-27?22:09??vibe\OpencvInclude.h
?????文件???????9402??2017-12-03?20:47??vibe\VIBE.cpp
?????文件???????1442??2017-10-30?22:48??vibe\VIBE.h
?????目錄??????????0??2017-12-21?20:58??vibe
-----------?---------??----------?-----??----
????????????????16026????????????????????8
評論
共有 條評論