background_subtractor.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  *
00003  * Software License Agreement (BSD License)
00004  *
00005  *  Copyright (c) 2017
00006  *  TU Dortmund - Institute of Control Theory and Systems Engineering.
00007  *  All rights reserved.
00008  *
00009  *  Redistribution and use in source and binary forms, with or without
00010  *  modification, are permitted provided that the following conditions
00011  *  are met:
00012  *
00013  *   * Redistributions of source code must retain the above copyright
00014  *     notice, this list of conditions and the following disclaimer.
00015  *   * Redistributions in binary form must reproduce the above
00016  *     copyright notice, this list of conditions and the following
00017  *     disclaimer in the documentation and/or other materials provided
00018  *     with the distribution.
00019  *   * Neither the name of the institute nor the names of its
00020  *     contributors may be used to endorse or promote products derived
00021  *     from this software without specific prior written permission.
00022  *
00023  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00026  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00027  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00028  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00029  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00032  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00033  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00034  *  POSSIBILITY OF SUCH DAMAGE.
00035  *
00036  * Notes:
00037  * The following code makes use of the OpenCV library.
00038  * OpenCV is licensed under the terms of the 3-clause BSD License.
00039  *
00040  * Authors: Franz Albers, Christoph Rösmann
00041  *********************************************************************/
00042 
00043 #ifndef BACKGROUNDSUBTRACTOR_H_
00044 #define BACKGROUNDSUBTRACTOR_H_
00045 
00046 #include <cv_bridge/cv_bridge.h>
00047 
00057 class BackgroundSubtractor
00058 {
00059 public:
00060   struct Params
00061   {
00062     double alpha_slow; 
00063     double alpha_fast; 
00064     double beta;
00065     double min_sep_between_fast_and_slow_filter;
00066     double min_occupancy_probability;
00067     double max_occupancy_neighbors;
00068     int morph_size;
00069   };
00070 
00072   BackgroundSubtractor(const Params& parameters);
00073 
00081   void apply(const cv::Mat& image, cv::Mat& fg_mask, int shift_x = 0, int shift_y = 0);
00082 
00088   void visualize(const std::string& name, const cv::Mat& image);
00089 
00096   void writeMatToYAML(const std::string& filename, const std::vector<cv::Mat>& mat_vec);
00097 
00099   void updateParameters(const Params& parameters);
00100 
00101 private:
00103   void transformToCurrentFrame(int shift_x, int shift_y);
00104 
00105   cv::Mat occupancy_grid_fast_;
00106   cv::Mat occupancy_grid_slow_;
00107   cv::Mat current_frame_;
00108 
00109   int previous_shift_x_;
00110   int previous_shift_y_;
00111 
00112   Params params_;
00113 };
00114 
00115 #endif // BACKGROUNDSUBTRACTOR_H_


costmap_converter
Author(s): Christoph Rösmann , Franz Albers , Otniel Rinaldo
autogenerated on Wed Sep 20 2017 03:00:37