VIBE算法源码.docx

上传人:b****6 文档编号:8869089 上传时间:2023-05-15 格式:DOCX 页数:49 大小:49.53KB
下载 相关 举报
VIBE算法源码.docx_第1页
第1页 / 共49页
VIBE算法源码.docx_第2页
第2页 / 共49页
VIBE算法源码.docx_第3页
第3页 / 共49页
VIBE算法源码.docx_第4页
第4页 / 共49页
VIBE算法源码.docx_第5页
第5页 / 共49页
VIBE算法源码.docx_第6页
第6页 / 共49页
VIBE算法源码.docx_第7页
第7页 / 共49页
VIBE算法源码.docx_第8页
第8页 / 共49页
VIBE算法源码.docx_第9页
第9页 / 共49页
VIBE算法源码.docx_第10页
第10页 / 共49页
VIBE算法源码.docx_第11页
第11页 / 共49页
VIBE算法源码.docx_第12页
第12页 / 共49页
VIBE算法源码.docx_第13页
第13页 / 共49页
VIBE算法源码.docx_第14页
第14页 / 共49页
VIBE算法源码.docx_第15页
第15页 / 共49页
VIBE算法源码.docx_第16页
第16页 / 共49页
VIBE算法源码.docx_第17页
第17页 / 共49页
VIBE算法源码.docx_第18页
第18页 / 共49页
VIBE算法源码.docx_第19页
第19页 / 共49页
VIBE算法源码.docx_第20页
第20页 / 共49页
亲,该文档总共49页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

VIBE算法源码.docx

《VIBE算法源码.docx》由会员分享,可在线阅读,更多相关《VIBE算法源码.docx(49页珍藏版)》请在冰点文库上搜索。

VIBE算法源码.docx

VIBE算法源码

VIBE算法源码

这是源代码,经过稍微的修改,可完美运行。

测试环境为vs2015+opencv3.4.6

无任何预处理,直接运行效果图:

vibe-background-sequential.h

/**

@filevibe-background-sequential.h

@briefInterfacefortheViBelibrary

@authorMarcVanDroogenbroeck

@dateJuly2014

@details

Fulldocumentationisavailableonlineat:

http:

//www.ulg.ac.be/telecom/research/vibe/doc

Alltechnicaldetailsareavailableinthefollowingpaper:

O.BarnichandM.VanDroogenbroeck.ViBe:

Auniversalbackgroundsubtractionalgorithmforvideosequences.IEEETransactionsonImageProcessing,20(6):

1709-1724,June2011.

\verbatim

BiBTeXinformation

@article{Barnich2011ViBe,

title={{ViBe}:

Auniversalbackgroundsubtractionalgorithmforvideosequences},

author={O.BarnichandM.{VanDroogenbroeck}},

journal={IEEETransactionsonImageProcessing},

volume={20},

number={6},

pages={1709-1724},

month={June},

year={2011},

keywords={ViBe,Background,Backgroundsubtraction,Segmentation,Motion,Motiondetection},

pdf={http:

//orbi.ulg.ac.be/bitstream/2268/145853/1/Barnich2011ViBe.pdf},

doi={10.1109/TIP.2010.2101613},

url={

}

\endverbatim

See

\citeBarnich2011ViBe

*/

#ifndef_VIBE_SEQUENTIAL_H_

#define_VIBE_SEQUENTIAL_H_

#ifdef__cplusplus

extern"C"

{

#endif

#include

#include

#include

#include

#defineCOLOR_BACKGROUND0/*!

#defineCOLOR_FOREGROUND255/*!

/**

*\typedefstructvibeModel_Sequential_t

*\briefDatastructureforthebackgroundsubtractionmodel.

*

*Thisdatastructurecontainsthebackgroundmodelaswellassomeparamatersvalue.

*Thecodeisdesignedtohidealltheimplementationdetailstotheusertoeaseitsuse.

*/

typedefstructvibeModel_SequentialvibeModel_Sequential_t;

/**

*Allocationofanewdatastructurewherethebackgroundmodelwillbestored.

*Pleasenotethatthisfunctiononlycreatesthestructuretohostthedata.

*Thisdatastructureswillonlybefilledwithacallto\reflibvibeModel_Sequential_AllocInit_8u_C1R.

*

*\resultApointertoanewlyallocated\refvibeModel_Sequential_t

*structure,orNULLinthecaseofanerror.

*/

vibeModel_Sequential_t*libvibeModel_Sequential_New();

/**

*ViBeusesseveralparameters.

*Youcanprintandchangesomeofthemifyouwant.However,default

*valueshouldmeetyourneedsformostvideos.

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@return

*/

uint32_tlibvibeModel_Sequential_PrintParameters(constvibeModel_Sequential_t*model);

/**

*Setter.

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@paramnumberOfSamples

*@return

*/

int32_tlibvibeModel_Sequential_SetNumberOfSamples(

vibeModel_Sequential_t*model,

constuint32_tnumberOfSamples

);

/**

*Setter.

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@return

*/

uint32_tlibvibeModel_Sequential_GetNumberOfSamples(constvibeModel_Sequential_t*model);

/**

*Setter.

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@parammatchingThreshold

*@return

*/

int32_tlibvibeModel_Sequential_SetMatchingThreshold(

vibeModel_Sequential_t*model,

constuint32_tmatchingThreshold

);

/**

*Setter.

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@return

*/

uint32_tlibvibeModel_Sequential_GetMatchingThreshold(constvibeModel_Sequential_t*model);

/**

*Setter.

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@parammatchingNumber

*@return

*/

int32_tlibvibeModel_Sequential_SetMatchingNumber(

vibeModel_Sequential_t*model,

constuint32_tmatchingNumber

);

/**

*Setter.

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@paramupdateFactorNewvaluefortheupdatefactor.Pleasenotethattheupdatefactoristobeunderstoodasaprobabilityofupdating.Morespecifically,anupdatefactorof16meansthat1outofevery16backgroundpixelsisupdated.Likewise,anupdatefactorof1meansthateverybackgroundpixelisupdated.

*@return

*/

int32_tlibvibeModel_Sequential_SetUpdateFactor(

vibeModel_Sequential_t*model,

constuint32_tupdateFactor

);

/**

*Getter.

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@return

*/

uint32_tlibvibeModel_Sequential_GetMatchingNumber(constvibeModel_Sequential_t*model);

 

/**

*Getter.

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@return

*/

uint32_tlibvibeModel_Sequential_GetUpdateFactor(constvibeModel_Sequential_t*model);

/**

*\briefFreesallthememoryusedbythemodelanddeallocatesthestructure.

*

*Thisfunctionfreesallthememoryallocatedby\reflibvibeModel_SequentialNewand

*\reflibvibeModel_Sequential_AllocInit_8u_C1Ror\reflibvibeModel_Sequential_AllocInit_8u_C3R.

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@return

*/

int32_tlibvibeModel_Sequential_Free(vibeModel_Sequential_t*model);

/**

*Thetwofollowingfunctionsallocatetherequiredmemoryaccordingtothe

*modelparametersandthedimensionsoftheinputimages.

*Youmustusethe"C1R"functionforgrayscaleimagesandthe"C3R"forcolor

*images.

*These2functionsalsoinitializethebackgroundmodelusingthecontent

*of*image_datawhichisthepixelbufferofthefirstimageofyourstream.

*/

//-------------------------Singlechannelimages----------------------------

/**

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@paramimage_data

*@paramwidth

*@paramheight

*@return

*/

int32_tlibvibeModel_Sequential_AllocInit_8u_C1R(

vibeModel_Sequential_t*model,

constuint8_t*image_data,

constuint32_twidth,

constuint32_theight

);

/*These2functionsperform2operations:

*-theyclassifythepixels*image_datausingtheprovidedmodelandstore

*theresultsin*segmentation_map.

*-theyupdate*modelaccordingtotheseresultsandthecontentof

**image_data.

*Youmustusethe"C1R"functionforgrayscaleimagesandthe"C3R"forcolor

*images.

*/

/**

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@paramimage_data

*@paramsegmentation_map

*@return

*/

int32_tlibvibeModel_Sequential_Segmentation_8u_C1R(

vibeModel_Sequential_t*model,

constuint8_t*image_data,

uint8_t*segmentation_map

);

/**

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@paramimage_data

*@paramupdating_mask

*@return

*/

int32_tlibvibeModel_Sequential_Update_8u_C1R(

vibeModel_Sequential_t*model,

constuint8_t*image_data,

uint8_t*updating_mask

);

//-------------------------Threechannelimages-----------------------------

/**

*Thepixelvaluesofcolorimagesarearrangedinthefollowingorder

*RGBRGBRGB...(orHSVHSVHSVHSVHSVHSV...)

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@paramimage_data

*@paramwidth

*@paramheight

*@return

*/

int32_tlibvibeModel_Sequential_AllocInit_8u_C3R(

vibeModel_Sequential_t*model,

constuint8_t*image_data,

constuint32_twidth,

constuint32_theight

);

/*These2functionsperform2operations:

*-theyclassifythepixels*image_datausingtheprovidedmodelandstore

*theresultsin*segmentation_map.

*-theyupdate*modelaccordingtotheseresultsandthecontentof

**image_data.

*Youmustusethe"C1R"functionforgrayscaleimagesandthe"C3R"forcolor

*images.

*/

/**

*Thepixelvaluesofcolorimagesarearrangedinthefollowingorder

*RGBRGBRGB...(orHSVHSVHSVHSVHSVHSV...)

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@paramimage_data

*@paramsegmentation_map

*@return

*/

int32_tlibvibeModel_Sequential_Segmentation_8u_C3R(

vibeModel_Sequential_t*model,

constuint8_t*image_data,

uint8_t*segmentation_map

);

/**

*Thepixelvaluesofcolorimagesarearrangedinthefollowingorder

*RGBRGBRGB...(orHSVHSVHSVHSVHSVHSV...)

*

*@parammodelThedatastructurewithViBe'sbackgroundsubtractionmodelandparameters.

*@paramimage_data

*@paramupdating_mask

*@return

*/

int32_tlibvibeModel_Sequential_Update_8u_C3R(

vibeModel_Sequential_t*model,

constuint8_t*image_data,

uint8_t*updating_mask

);

#ifdef__cplusplus

}

#endif

#endif

 

vibe-background-sequential.cpp

/**

@filevibe-background-sequential.c

@briefImplementationofvibe-background-sequential.h

@authorMarcVanDroogenbroeck

@dateMay2014

*/

/*

Thereareafewimplementation"tricks"[byMarcVanDroogenbroeck].

PleasenotethatTHEYDON'TAFFECTTHEBEHAVIOROFViBebuthelpspeedinguptheimplementation;theyaredescribedhereafter.

1.Swappingvaluesinordertobringbestmatchingcandidatesinthefirstplacesofthememory

TheideaisthatViBeonlyneedstwomatchestoclassifyapixelintothebackground;tosomeextent,the18otherpixels(outofN=20pixels)arethenuseless.Inaddition,mostofthetime,therearenobigchangesbetweenpixelslocatedatthesameplacefromsuccessiveimages(90%ofthepixelsareinthebackgroundonaverage).Ther

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > PPT模板 > 商务科技

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2