C/C++ library for the ViBe algorithm
Macros | Typedefs | Functions
vibe-background-sequential.h File Reference

Interface for the ViBe library. More...

#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for vibe-background-sequential.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define COLOR_BACKGROUND   0
 
#define COLOR_FOREGROUND   255
 

Typedefs

typedef struct vibeModel_Sequential vibeModel_Sequential_t
 Data structure for the background subtraction model. More...
 

Functions

int32_t libvibeModel_Sequential_AllocInit_8u_C1R (vibeModel_Sequential_t *model, const uint8_t *image_data, const uint32_t width, const uint32_t height)
 
int32_t libvibeModel_Sequential_AllocInit_8u_C3R (vibeModel_Sequential_t *model, const uint8_t *image_data, const uint32_t width, const uint32_t height)
 
int32_t libvibeModel_Sequential_Free (vibeModel_Sequential_t *model)
 Frees all the memory used by the model and deallocates the structure. More...
 
uint32_t libvibeModel_Sequential_GetMatchingNumber (const vibeModel_Sequential_t *model)
 
uint32_t libvibeModel_Sequential_GetMatchingThreshold (const vibeModel_Sequential_t *model)
 
uint32_t libvibeModel_Sequential_GetNumberOfSamples (const vibeModel_Sequential_t *model)
 
uint32_t libvibeModel_Sequential_GetUpdateFactor (const vibeModel_Sequential_t *model)
 
vibeModel_Sequential_tlibvibeModel_Sequential_New ()
 
uint32_t libvibeModel_Sequential_PrintParameters (const vibeModel_Sequential_t *model)
 
int32_t libvibeModel_Sequential_Segmentation_8u_C1R (vibeModel_Sequential_t *model, const uint8_t *image_data, uint8_t *segmentation_map)
 
int32_t libvibeModel_Sequential_Segmentation_8u_C3R (vibeModel_Sequential_t *model, const uint8_t *image_data, uint8_t *segmentation_map)
 
int32_t libvibeModel_Sequential_SetMatchingNumber (vibeModel_Sequential_t *model, const uint32_t matchingNumber)
 
int32_t libvibeModel_Sequential_SetMatchingThreshold (vibeModel_Sequential_t *model, const uint32_t matchingThreshold)
 
int32_t libvibeModel_Sequential_SetNumberOfSamples (vibeModel_Sequential_t *model, const uint32_t numberOfSamples)
 
int32_t libvibeModel_Sequential_SetUpdateFactor (vibeModel_Sequential_t *model, const uint32_t updateFactor)
 
int32_t libvibeModel_Sequential_Update_8u_C1R (vibeModel_Sequential_t *model, const uint8_t *image_data, uint8_t *updating_mask)
 
int32_t libvibeModel_Sequential_Update_8u_C3R (vibeModel_Sequential_t *model, const uint8_t *image_data, uint8_t *updating_mask)
 

Detailed Description

Interface for the ViBe library.

Author
Marc Van Droogenbroeck
Date
July 2014

Full documentation is available online at: http://www.ulg.ac.be/telecom/research/vibe/doc

All technical details are available in the following paper: O. Barnich and M. Van Droogenbroeck. ViBe: A universal background subtraction algorithm for video sequences. IEEE Transactions on Image Processing, 20(6):1709-1724, June 2011.

BiBTeX information

  @article{Barnich2011ViBe,
  title = {{ViBe}: A universal background subtraction algorithm for video sequences},
  author = {O. Barnich and M. {Van Droogenbroeck}},
  journal = {IEEE Transactions on Image Processing},
  volume = {20},
  number = {6},
  pages = {1709-1724},
  month = {June},
  year = {2011},
  keywords = {ViBe, Background, Background subtraction, Segmentation, Motion, Motion detection},
  pdf = {http://orbi.ulg.ac.be/bitstream/2268/145853/1/Barnich2011ViBe.pdf},
  doi = {10.1109/TIP.2010.2101613},
  url = {http://hdl.handle.net/2268/145853}
  }

See [2]

Definition in file vibe-background-sequential.h.

Macro Definition Documentation

#define COLOR_BACKGROUND   0

Default label for background pixels

Definition at line 53 of file vibe-background-sequential.h.

#define COLOR_FOREGROUND   255

Default label for foreground pixels. Note that some authors chose any value different from 0 instead

Definition at line 54 of file vibe-background-sequential.h.

Typedef Documentation

Data structure for the background subtraction model.

This data structure contains the background model as well as some paramaters value. The code is designed to hide all the implementation details to the user to ease its use.

Definition at line 63 of file vibe-background-sequential.h.

Function Documentation

int32_t libvibeModel_Sequential_AllocInit_8u_C1R ( vibeModel_Sequential_t model,
const uint8_t *  image_data,
const uint32_t  width,
const uint32_t  height 
)

The two following functions allocate the required memory according to the model parameters and the dimensions of the input images. You must use the "C1R" function for grayscale images and the "C3R" for color images. These 2 functions also initialize the background model using the content of *image_data which is the pixel buffer of the first image of your stream.

Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
image_data
width
height
Returns

Referenced by processVideo().

int32_t libvibeModel_Sequential_AllocInit_8u_C3R ( vibeModel_Sequential_t model,
const uint8_t *  image_data,
const uint32_t  width,
const uint32_t  height 
)

The pixel values of color images are arranged in the following order RGBRGBRGB... (or HSVHSVHSVHSVHSVHSV...)

Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
image_data
width
height
Returns
int32_t libvibeModel_Sequential_Free ( vibeModel_Sequential_t model)

Frees all the memory used by the model and deallocates the structure.

This function frees all the memory allocated by libvibeModel_SequentialNew and libvibeModel_Sequential_AllocInit_8u_C1R or libvibeModel_Sequential_AllocInit_8u_C3R.

Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
Returns

Referenced by processVideo().

uint32_t libvibeModel_Sequential_GetMatchingNumber ( const vibeModel_Sequential_t model)

Getter.

Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
Returns
uint32_t libvibeModel_Sequential_GetMatchingThreshold ( const vibeModel_Sequential_t model)

Setter.

Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
Returns
uint32_t libvibeModel_Sequential_GetNumberOfSamples ( const vibeModel_Sequential_t model)

Setter.

Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
Returns
uint32_t libvibeModel_Sequential_GetUpdateFactor ( const vibeModel_Sequential_t model)

Getter.

Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
Returns
vibeModel_Sequential_t* libvibeModel_Sequential_New ( )

Allocation of a new data structure where the background model will be stored. Please note that this function only creates the structure to host the data. This data structures will only be filled with a call to libvibeModel_Sequential_AllocInit_8u_C1R.

Returns
A pointer to a newly allocated vibeModel_Sequential_t structure, or NULL in the case of an error.

Referenced by processVideo().

uint32_t libvibeModel_Sequential_PrintParameters ( const vibeModel_Sequential_t model)

ViBe uses several parameters. You can print and change some of them if you want. However, default value should meet your needs for most videos.

Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
Returns
int32_t libvibeModel_Sequential_Segmentation_8u_C1R ( vibeModel_Sequential_t model,
const uint8_t *  image_data,
uint8_t *  segmentation_map 
)
Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
image_data
segmentation_map
Returns

Referenced by processVideo().

int32_t libvibeModel_Sequential_Segmentation_8u_C3R ( vibeModel_Sequential_t model,
const uint8_t *  image_data,
uint8_t *  segmentation_map 
)

The pixel values of color images are arranged in the following order RGBRGBRGB... (or HSVHSVHSVHSVHSVHSV...)

Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
image_data
segmentation_map
Returns
int32_t libvibeModel_Sequential_SetMatchingNumber ( vibeModel_Sequential_t model,
const uint32_t  matchingNumber 
)

Setter.

Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
matchingNumber
Returns
int32_t libvibeModel_Sequential_SetMatchingThreshold ( vibeModel_Sequential_t model,
const uint32_t  matchingThreshold 
)

Setter.

Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
matchingThreshold
Returns
int32_t libvibeModel_Sequential_SetNumberOfSamples ( vibeModel_Sequential_t model,
const uint32_t  numberOfSamples 
)

Setter.

Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
numberOfSamples
Returns
int32_t libvibeModel_Sequential_SetUpdateFactor ( vibeModel_Sequential_t model,
const uint32_t  updateFactor 
)

Setter.

Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
updateFactorNew value for the update factor. Please note that the update factor is to be understood as a probability of updating. More specifically, an update factor of 16 means that 1 out of every 16 background pixels is updated. Likewise, an update factor of 1 means that every background pixel is updated.
Returns
int32_t libvibeModel_Sequential_Update_8u_C1R ( vibeModel_Sequential_t model,
const uint8_t *  image_data,
uint8_t *  updating_mask 
)
Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
image_data
updating_mask
Returns

Referenced by processVideo().

int32_t libvibeModel_Sequential_Update_8u_C3R ( vibeModel_Sequential_t model,
const uint8_t *  image_data,
uint8_t *  updating_mask 
)

The pixel values of color images are arranged in the following order RGBRGBRGB... (or HSVHSVHSVHSVHSVHSV...)

Parameters
modelThe data structure with ViBe's background subtraction model and parameters.
image_data
updating_mask
Returns

License/Copyright

This code is copyrighted by the University of Liège, Belgium. 
It is only shared for research purposes. Please do not distribute it. 
Prof. M. Van Droogenbroeck, July 2014.