MedianFillFilter.hpp
Go to the documentation of this file.
1 /*
2  * MedianFillFilter.hpp
3  *
4  * Created on: September 7, 2020
5  * Author: Magnus Gärtner
6  * Institute: ETH Zurich, ANYbotics
7  */
8 
9 #pragma once
10 
11 #include <filters/filter_base.hpp>
12 
13 #include <Eigen/Core>
14 #include <string>
15 
17 #include <opencv2/core.hpp>
18 
19 namespace grid_map {
20 
25 template <typename T>
27  public:
32 
36  virtual ~MedianFillFilter();
37 
41  virtual bool configure();
42 
50  virtual bool update(const T& mapIn, T& mapOut);
51 
52  protected:
63  float getMedian(Eigen::Ref<const grid_map::Matrix> inputMap, const grid_map::Index& centerIndex, const size_t radiusInPixels,
64  const grid_map::Size bufferSize);
65 
76  Eigen::MatrixXf computeAndAddFillMask(const Eigen::MatrixXf& inputMap, T& mapOut);
77 
85  cv::Mat_<bool> cleanedMask(const cv::Mat_<bool>& inputMask);
86 
93  cv::Mat_<bool> fillHoles(const cv::Mat_<bool>& isValidMask, const size_t numDilationClosingIterations);
94 
101  void addCvMatAsLayer(T& gridMap, const cv::Mat& cvLayer, const std::string& layerName);
102 
103  private:
106 
109 
112 
114  std::string inputLayer_;
115 
117  std::string outputLayer_;
118 
120  std::string fillMaskLayer_ = "should_fill";
121 
123  std::string debugInfillMaskLayer_ = "debug_infill_mask";
124 
126  bool debug_;
127 };
128 
129 } // namespace grid_map
Eigen::Array2i Index
float getMedian(Eigen::Ref< const grid_map::Matrix > inputMap, const grid_map::Index &centerIndex, const size_t radiusInPixels, const grid_map::Size bufferSize)
virtual bool update(const T &mapIn, T &mapOut)
Eigen::Array2i Size
double fillHoleRadius_
Median filtering radius of NaN values in the input.
std::string inputLayer_
Input layer name.
void addCvMatAsLayer(T &gridMap, const cv::Mat &cvLayer, const std::string &layerName)
Eigen::MatrixXf computeAndAddFillMask(const Eigen::MatrixXf &inputMap, T &mapOut)
cv::Mat_< bool > fillHoles(const cv::Mat_< bool > &isValidMask, const size_t numDilationClosingIterations)
std::string debugInfillMaskLayer_
Layer used to visualize the intermediate, sparse outlier removed fill mask.
cv::Mat_< bool > cleanedMask(const cv::Mat_< bool > &inputMask)
std::string outputLayer_
Output layer name.
bool debug_
If set, the filtered grid_map is augmented with additional debug layers.
bool filterExistingValues_
Flag indicating whether to also filter finite values.
std::string fillMaskLayer_
Layer containing indicating which areas to fill, will be computed if not present. ...
double existingValueRadius_
Median filtering radius for existing values in the input.


grid_map_filters
Author(s): Péter Fankhauser , Martin Wermelinger
autogenerated on Tue Jun 1 2021 02:13:38