MRPT  1.9.9
CFaceDetection.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-2018, 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 
10 #ifndef CFaceDetection_H
11 #define CFaceDetection_H
12 
17 #include <mrpt/obs/obs_frwds.h>
18 
19 #include <future>
20 
21 namespace mrpt
22 {
23 /** \ingroup mrpt_detectors_grp */
24 namespace detectors
25 {
26 /** Specific class for face detection.
27  * Methods and variables labeled as experimentals are temporals (for debug or
28  * testing
29  * purposes) and may disappear in future versions.
30  * \ingroup mrpt_detectors_grp
31  */
33 {
34  public:
36 
38 
40 
41  virtual void init(const mrpt::config::CConfigFileBase& cfg);
42 
43  virtual void detectObjects_Impl(
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 */
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 
154 
156 
158 
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::CArrayDouble<3>>& pointsVector,
187  const mrpt::math::CMatrixDouble& eigenVect,
188  const mrpt::math::CVectorDouble& 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, const size_t& c1, const size_t& r1,
202  const size_t& c2, const size_t& r2,
204 
205 }; // End of class
206 }
207 }
208 
209 #endif
std::thread m_thread_checkIfFacePlaneCov
Thread that execute checkIfFacePlaneCov filter.
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)
void experimental_viewFacePointsAndEigenVects(const std::vector< mrpt::math::CArrayDouble< 3 >> &pointsVector, const mrpt::math::CMatrixDouble &eigenVect, const mrpt::math::CVectorDouble &eigenVal)
static void dummy_checkIfDiagonalSurface(CFaceDetection *obj)
std::thread m_thread_checkIfDiagonalSurface
Thread that execute checkIfDiagonalSurface filter.
CArrayNumeric is an array for numeric types supporting several mathematical operations (actually...
Definition: CArrayNumeric.h:25
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement, as from a time-of-flight range camera or any other RGBD sensor.
struct mrpt::detectors::CFaceDetection::TTestsOptions m_testsOptions
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction...
Definition: eigen_frwds.h:44
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)
std::vector< CDetectableObject::Ptr > vector_detectable_object
std::promise< void > m_enter_checkIfFacePlaneCov
Indicates to thread_checkIfFacePlaneCov that exist a new face to analyze.
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
mrpt::obs::CObservation3DRangeScan m_lastFaceDetected
Last face detected.
GLsizei const GLfloat * points
Definition: glext.h:5339
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...
void experimental_calcHist(const mrpt::img::CImage &face, const size_t &c1, const size_t &r1, const size_t &c2, const size_t &r2, mrpt::math::CMatrixTemplate< unsigned int > &hist)
bool checkIfDiagonalSurface2(mrpt::obs::CObservation3DRangeScan *face)
bool checkIfFacePlaneCov(mrpt::obs::CObservation3DRangeScan *face)
virtual void init(const mrpt::config::CConfigFileBase &cfg)
Initialize the object with parameters loaded from the given config source.
bool checkIfFaceRegions(mrpt::obs::CObservation3DRangeScan *face)
void experimental_segmentFace(const mrpt::obs::CObservation3DRangeScan &face, mrpt::math::CMatrixTemplate< bool > &region)
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
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)
virtual void detectObjects_Impl(const mrpt::obs::CObservation *obs, vector_detectable_object &detected)
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)
std::promise< void > m_enter_checkIfFaceRegions
Indicates to thread_checkIfFaceRegions that exist a new face to analyze.
Lightweight 3D point.
bool m_checkIfDiagonalSurface_res
Save result of checkIfDiagonalSurface filter.
GLfloat GLfloat p
Definition: glext.h:6305
struct mrpt::detectors::CFaceDetection::TOptions m_options
bool m_checkIfFacePlaneCov_res
Save result of checkIfFacePlaneCov filter.
GLenum GLuint GLint GLenum face
Definition: glext.h:8194
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:130
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020