Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
BackgroundSubtractor Class Reference

Perform background subtraction to extract the "moving" foreground. More...

#include <background_subtractor.h>

Classes

struct  Params
 

Public Member Functions

void apply (const cv::Mat &image, cv::Mat &fg_mask, int shift_x=0, int shift_y=0)
 Computes a foreground mask. More...
 
 BackgroundSubtractor (const Params &parameters)
 Constructor that accepts a specific parameter configuration. More...
 
void updateParameters (const Params &parameters)
 Update internal parameters. More...
 
void visualize (const std::string &name, const cv::Mat &image)
 OpenCV Visualization. More...
 
void writeMatToYAML (const std::string &filename, const std::vector< cv::Mat > &mat_vec)
 Export vector of matrices to yaml file. More...
 

Private Member Functions

void transformToCurrentFrame (int shift_x, int shift_y)
 Transform/shift all internal matrices/grids according to a given translation vector. More...
 

Private Attributes

cv::Mat current_frame_
 
cv::Mat occupancy_grid_fast_
 
cv::Mat occupancy_grid_slow_
 
Params params_
 
int previous_shift_x_
 
int previous_shift_y_
 

Detailed Description

Perform background subtraction to extract the "moving" foreground.

This class is based on OpenCV's background subtraction class cv::BackgroundSubtractor. It has been modified in order to incorporate a specialized bandpass filter.

See http://docs.opencv.org/3.2.0/d7/df6/classcv_1_1BackgroundSubtractor.html for the original class.

Definition at line 57 of file background_subtractor.h.

Constructor & Destructor Documentation

BackgroundSubtractor::BackgroundSubtractor ( const Params parameters)

Constructor that accepts a specific parameter configuration.

Definition at line 5 of file background_subtractor.cpp.

Member Function Documentation

void BackgroundSubtractor::apply ( const cv::Mat &  image,
cv::Mat &  fg_mask,
int  shift_x = 0,
int  shift_y = 0 
)

Computes a foreground mask.

Parameters
[in]imageNext video frame
[out]fg_maskForeground mask as an 8-bit binary image
[in]shift_xTranslation along the x axis between the current and previous image
[in]shift_yTranslation along the y axis between the current and previous image

Definition at line 9 of file background_subtractor.cpp.

void BackgroundSubtractor::transformToCurrentFrame ( int  shift_x,
int  shift_y 
)
private

Transform/shift all internal matrices/grids according to a given translation vector.

Definition at line 84 of file background_subtractor.cpp.

void BackgroundSubtractor::updateParameters ( const Params parameters)

Update internal parameters.

Definition at line 112 of file background_subtractor.cpp.

void BackgroundSubtractor::visualize ( const std::string &  name,
const cv::Mat &  image 
)

OpenCV Visualization.

Parameters
nameId/name of the opencv window
imageImage to be visualized

Definition at line 101 of file background_subtractor.cpp.

void BackgroundSubtractor::writeMatToYAML ( const std::string &  filename,
const std::vector< cv::Mat > &  mat_vec 
)

Export vector of matrices to yaml file.

Remarks
This method is intended for debugging purposes
Parameters
filenameDesired filename including path and excluding file suffix
mat_vecVector of cv::Mat to be exported

Member Data Documentation

cv::Mat BackgroundSubtractor::current_frame_
private

Definition at line 107 of file background_subtractor.h.

cv::Mat BackgroundSubtractor::occupancy_grid_fast_
private

Definition at line 105 of file background_subtractor.h.

cv::Mat BackgroundSubtractor::occupancy_grid_slow_
private

Definition at line 106 of file background_subtractor.h.

Params BackgroundSubtractor::params_
private

Definition at line 112 of file background_subtractor.h.

int BackgroundSubtractor::previous_shift_x_
private

Definition at line 109 of file background_subtractor.h.

int BackgroundSubtractor::previous_shift_y_
private

Definition at line 110 of file background_subtractor.h.


The documentation for this class was generated from the following files:


costmap_converter
Author(s): Christoph Rösmann , Franz Albers , Otniel Rinaldo
autogenerated on Sat May 16 2020 03:19:18