Main MRPT website > C++ reference for MRPT 1.5.6
TRangeImageFilter.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 #ifndef TRangeImageFilter_H
10 #define CObservation3DRangeScan_H
11 
12 #include <mrpt/utils/core_defs.h>
13 #include <mrpt/math/CMatrix.h>
14 #include <mrpt/obs/link_pragmas.h>
15 
16 namespace mrpt {
17 namespace obs {
18 
19  /** Used in CObservation3DRangeScan::project3DPointsFromDepthImageInto() */
21  {
22  /** Only used if <b>both</b> rangeMask_min and rangeMask_max are present.
23  * This switches which condition must fulfill a range `D` to be accepted as valid:
24  * - `rangeCheckBetween=true` : valid = (D>=rangeMask_min && D<=rangeMask_max)
25  * - `rangeCheckBetween=false`: valid = !(D>=rangeMask_min && D<=rangeMask_max)
26  *
27  * \note Default value:true */
29  /** (Default: NULL) If provided, each data range will be tested to be greater-than (rangeMask_min) or less-than (rangeMask_max) each element in these matrices
30  * for each direction (row,col). Values of 0.0f mean no filtering at those directions.
31  * If both `rangeMask_min` and `rangeMask_max` are provided, the joint filtering operation is determined by `rangeCheckBetween` */
32  const mrpt::math::CMatrix * rangeMask_min, * rangeMask_max;
33  TRangeImageFilterParams() : rangeCheckBetween(true), rangeMask_min(NULL), rangeMask_max(NULL)
34  {}
35  };
36 
37  /** Mainly for internal use within CObservation3DRangeScan::project3DPointsFromDepthImageInto() */
39  {
41  inline bool do_range_filter(size_t r, size_t c, const float D) const; //!< Returns true if the point (r,c) with depth D passes all filters.
42  inline TRangeImageFilter(const TRangeImageFilterParams &filter_params) : fp(filter_params) {}
43  inline TRangeImageFilter() {}
44  };
45 
46 
47  // ======== Implementation ========
48  bool TRangeImageFilter::do_range_filter(size_t r, size_t c, const float D) const {
49  // Filters:
50  if (D<=.0f)
51  return false;
52  // Greater-than/Less-than filters:
53  bool pass_gt=true, pass_lt=true;
54  bool has_min_filter = false, has_max_filter = false;
55  if (fp.rangeMask_min) {
56  const float min_d = fp.rangeMask_min->coeff(r,c);
57  if (min_d!=.0f) {
58  has_min_filter = true;
59  pass_gt = (D>=min_d);
60  }
61  }
62  if (fp.rangeMask_max) {
63  const float max_d = fp.rangeMask_max->coeff(r,c);
64  if (max_d!=.0f) {
65  has_max_filter=true;
66  pass_lt = (D<=max_d);
67  }
68  }
69  if (has_min_filter && has_max_filter) {
70  return fp.rangeCheckBetween ? (pass_gt && pass_lt) : !(pass_gt && pass_lt);
71  }
72  else return pass_gt && pass_lt;
73  } // do_range_filter()
74 
75 } } // End of namespaces
76 
77 #endif
Mainly for internal use within CObservation3DRangeScan::project3DPointsFromDepthImageInto() ...
const GLfloat * c
Definition: glew.h:10088
const mrpt::math::CMatrix * rangeMask_min
(Default: NULL) If provided, each data range will be tested to be greater-than (rangeMask_min) or les...
Used in CObservation3DRangeScan::project3DPointsFromDepthImageInto()
TRangeImageFilter(const TRangeImageFilterParams &filter_params)
TRangeImageFilterParams fp
const mrpt::math::CMatrix * rangeMask_max
GLdouble GLdouble GLdouble r
Definition: glew.h:1311
bool do_range_filter(size_t r, size_t c, const float D) const
Returns true if the point (r,c) with depth D passes all filters.
This class is a "CSerializable" wrapper for "CMatrixFloat".
Definition: CMatrix.h:30
bool rangeCheckBetween
Only used if both rangeMask_min and rangeMask_max are present.
GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble f
Definition: glew.h:5092



Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018