MRPT  1.9.9
CFaceDetection.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
16 #include <mrpt/obs/obs_frwds.h>
18 #include <future>
19 
20 namespace mrpt
21 {
22 /** \ingroup mrpt_detectors_grp */
23 namespace detectors
24 {
25 /** Specific class for face detection.
26  * Methods and variables labeled as experimentals are temporals (for debug or
27  * testing
28  * purposes) and may disappear in future versions.
29  * \ingroup mrpt_detectors_grp
30  */
32 {
33  public:
35 
37 
39 
40  void init(const mrpt::config::CConfigFileBase& cfg) override;
41 
42  void detectObjects_Impl(
43  const mrpt::obs::CObservation& obs,
44  vector_detectable_object& detected) override;
45 
46  struct TOptions
47  {
50 
55 
56  bool batchMode;
57 
58  } m_options;
59 
61  {
67 
69 
70  // Experimental methods
72 
74  const std::vector<uint32_t>& falsePositives,
75  const std::vector<uint32_t>& ignore,
76  unsigned int& falsePositivesDeleted, unsigned int& realFacesDeleted);
77 
78  private:
79  /** Thread that execute checkIfFaceRegions filter */
81  /** Thread that execute checkIfFacePlaneCov filter */
83  /** Thread that execute checkIfDiagonalSurface filter */
85 
86  /** Save result of checkIfFaceRegions filter */
88  /** Save result of checkIfFacePlaneCov filter */
90  /** Save result of checkIfDiagonalSurface filter */
92 
93  /** Indicates to all threads that must finish their execution */
94  bool m_end_threads{false};
95 
96  /** Indicates to thread_checkIfFaceRegions that exist a new face to analyze
97  */
98  std::promise<void> m_enter_checkIfFaceRegions;
99  /** Indicates to thread_checkIfFacePlaneCov that exist a new face to analyze
100  */
101  std::promise<void> m_enter_checkIfFacePlaneCov;
102  /** Indicates to thread_checkIfDiagonalSurface that exist a new face to
103  * analyze */
104  std::promise<void> m_enter_checkIfDiagonalSurface;
105 
106  /** Indicates to main thread that thread_checkIfFaceRegions has been
107  * completed analisis of the last face detected */
108  std::promise<void> m_leave_checkIfFaceRegions;
109  /** Indicates to main thread that thread_checkIfFacePlaneCov has been
110  * completed analisis of the last face detected */
111  std::promise<void> m_leave_checkIfFacePlaneCov;
112  /** Indicates to main thread that thread_checkIfDiagonalSurface has been
113  * completed analisis of the last face detected */
114  std::promise<void> m_leave_checkIfDiagonalSurface;
115 
116  /** Last face detected */
118 
120  {
122 
126 
128 
129  int faceNum;
130  std::vector<uint32_t> deletedRegions;
133 
134  bool takeTime;
135 
137 
138  } m_measure;
139 
140  // To take measures abaout execution time
142 
143  std::vector<double> m_meanHist;
144 
145  // Test to check if a candidate region is a real face
146 
148 
150 
152 
153  static void dummy_checkIfFacePlaneCov(CFaceDetection* obj);
154 
156 
158 
159  static void dummy_checkIfFaceRegions(CFaceDetection* obj);
160 
161  size_t checkRelativePosition(
162  const mrpt::math::TPoint3D& p1, const mrpt::math::TPoint3D& p2,
163  const mrpt::math::TPoint3D& p, double& dist);
164 
166 
168 
170 
172 
173  // Experimental methods to view 3D points
174 
176  const std::vector<float>& xs, const std::vector<float>& ys,
177  const std::vector<float>& zs);
178 
181 
183  const std::vector<mrpt::math::TPoint3D>& points);
184 
186  const std::vector<mrpt::math::CVectorFixedDouble<3>>& pointsVector,
187  const mrpt::math::CMatrixDouble& eigenVect,
188  const std::vector<double>& eigenVal);
189 
191  const std::vector<mrpt::math::TPoint3D> regions[9],
192  const mrpt::math::TPoint3D meanPos[3][3]);
193 
194  // Segmentation methods
198 
199  // Histogram methods
201  const mrpt::img::CImage& face, size_t c1, size_t r1, size_t c2,
203 
204 }; // End of class
205 } // namespace detectors
206 } // namespace mrpt
std::thread m_thread_checkIfFacePlaneCov
Thread that execute checkIfFacePlaneCov filter.
A compile-time fixed-size numeric matrix container.
Definition: CMatrixFixed.h:33
bool m_end_threads
Indicates to all threads that must finish their execution.
CCascadeClassifierDetection cascadeClassifier
bool m_checkIfFaceRegions_res
Save result of checkIfFaceRegions filter.
void debug_returnResults(const std::vector< uint32_t > &falsePositives, const std::vector< uint32_t > &ignore, unsigned int &falsePositivesDeleted, unsigned int &realFacesDeleted)
static void dummy_checkIfDiagonalSurface(CFaceDetection *obj)
std::thread m_thread_checkIfDiagonalSurface
Thread that execute checkIfDiagonalSurface filter.
A range or depth 3D scan measurement, as from a time-of-flight range camera or a structured-light dep...
struct mrpt::detectors::CFaceDetection::TTestsOptions m_testsOptions
void detectObjects_Impl(const mrpt::obs::CObservation &obs, vector_detectable_object &detected) override
std::vector< double > m_meanHist
size_t checkRelativePosition(const mrpt::math::TPoint3D &p1, const mrpt::math::TPoint3D &p2, const mrpt::math::TPoint3D &p, double &dist)
void experimental_calcHist(const mrpt::img::CImage &face, size_t c1, size_t r1, size_t c2, size_t r2, mrpt::math::CMatrixDynamic< unsigned int > &hist)
std::vector< CDetectableObject::Ptr > vector_detectable_object
std::promise< void > m_enter_checkIfFacePlaneCov
Indicates to thread_checkIfFacePlaneCov that exist a new face to analyze.
mrpt::obs::CObservation3DRangeScan m_lastFaceDetected
Last face detected.
vector< std::vector< uint32_t > > falsePositives
std::thread m_thread_checkIfFaceRegions
Thread that execute checkIfFaceRegions filter.
std::promise< void > m_leave_checkIfFaceRegions
Indicates to main thread that thread_checkIfFaceRegions has been completed analisis of the last face ...
This class allows loading and storing values and vectors of different types from a configuration text...
bool checkIfDiagonalSurface2(mrpt::obs::CObservation3DRangeScan *face)
bool checkIfFacePlaneCov(mrpt::obs::CObservation3DRangeScan *face)
bool checkIfFaceRegions(mrpt::obs::CObservation3DRangeScan *face)
bool checkIfDiagonalSurface(mrpt::obs::CObservation3DRangeScan *face)
Specific class for face detection.
std::promise< void > m_leave_checkIfFacePlaneCov
Indicates to main thread that thread_checkIfFacePlaneCov has been completed analisis of the last face...
std::promise< void > m_enter_checkIfDiagonalSurface
Indicates to thread_checkIfDiagonalSurface that exist a new face to analyze.
struct mrpt::detectors::CFaceDetection::TMeasurement m_measure
void experimental_viewFacePointsAndEigenVects(const std::vector< mrpt::math::CVectorFixedDouble< 3 >> &pointsVector, const mrpt::math::CMatrixDouble &eigenVect, const std::vector< double > &eigenVal)
void init(const mrpt::config::CConfigFileBase &cfg) override
Initialize the object with parameters loaded from the given config source.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
bool checkIfFacePlane(mrpt::obs::CObservation3DRangeScan *face)
A versatile "profiler" that logs the time spent within each pair of calls to enter(X)-leave(X), among other stats.
void experimental_viewFacePointsScanned(const std::vector< float > &xs, const std::vector< float > &ys, const std::vector< float > &zs)
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:43
mrpt::system::CTimeLogger m_timeLog
static void dummy_checkIfFacePlaneCov(CFaceDetection *obj)
std::promise< void > m_leave_checkIfDiagonalSurface
Indicates to main thread that thread_checkIfDiagonalSurface has been completed analisis of the last f...
static void dummy_checkIfFaceRegions(CFaceDetection *obj)
void experimental_segmentFace(const mrpt::obs::CObservation3DRangeScan &face, mrpt::math::CMatrixDynamic< bool > &region)
std::promise< void > m_enter_checkIfFaceRegions
Indicates to thread_checkIfFaceRegions that exist a new face to analyze.
bool m_checkIfDiagonalSurface_res
Save result of checkIfDiagonalSurface filter.
struct mrpt::detectors::CFaceDetection::TOptions m_options
bool m_checkIfFacePlaneCov_res
Save result of checkIfFacePlaneCov filter.
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:148
void experimental_viewRegions(const std::vector< mrpt::math::TPoint3D > regions[9], const mrpt::math::TPoint3D meanPos[3][3])



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020