background_subtractor.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2017
6  * TU Dortmund - Institute of Control Theory and Systems Engineering.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of the institute nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  * Notes:
37  * The following code makes use of the OpenCV library.
38  * OpenCV is licensed under the terms of the 3-clause BSD License.
39  *
40  * Authors: Franz Albers, Christoph Rösmann
41  *********************************************************************/
42 
43 #ifndef BACKGROUNDSUBTRACTOR_H_
44 #define BACKGROUNDSUBTRACTOR_H_
45 
46 #include <cv_bridge/cv_bridge.h>
47 
58 {
59 public:
60  struct Params
61  {
62  double alpha_slow;
63  double alpha_fast;
64  double beta;
69  };
70 
72  BackgroundSubtractor(const Params& parameters);
73 
81  void apply(const cv::Mat& image, cv::Mat& fg_mask, int shift_x = 0, int shift_y = 0);
82 
88  void visualize(const std::string& name, const cv::Mat& image);
89 
96  void writeMatToYAML(const std::string& filename, const std::vector<cv::Mat>& mat_vec);
97 
99  void updateParameters(const Params& parameters);
100 
101 private:
103  void transformToCurrentFrame(int shift_x, int shift_y);
104 
107  cv::Mat current_frame_;
108 
111 
113 };
114 
115 #endif // BACKGROUNDSUBTRACTOR_H_
void apply(const cv::Mat &image, cv::Mat &fg_mask, int shift_x=0, int shift_y=0)
Computes a foreground mask.
double alpha_fast
Filter constant (learning rate) of the fast filter part.
void visualize(const std::string &name, const cv::Mat &image)
OpenCV Visualization.
double alpha_slow
Filter constant (learning rate) of the slow filter part.
void transformToCurrentFrame(int shift_x, int shift_y)
Transform/shift all internal matrices/grids according to a given translation vector.
Perform background subtraction to extract the "moving" foreground.
void writeMatToYAML(const std::string &filename, const std::vector< cv::Mat > &mat_vec)
Export vector of matrices to yaml file.
BackgroundSubtractor(const Params &parameters)
Constructor that accepts a specific parameter configuration.
void updateParameters(const Params &parameters)
Update internal parameters.


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