Main MRPT website > C++ reference for 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
mrpt::detectors::CFaceDetection::checkRelativePosition
size_t checkRelativePosition(const mrpt::math::TPoint3D &p1, const mrpt::math::TPoint3D &p2, const mrpt::math::TPoint3D &p, double &dist)
Definition: CFaceDetection.cpp:801
mrpt::detectors::CFaceDetection::TMeasurement::lessEigenVals
mrpt::math::CVectorDouble lessEigenVals
Definition: CFaceDetection.h:123
mrpt::detectors::CFaceDetection::thread_checkIfFacePlaneCov
void thread_checkIfFacePlaneCov()
Definition: CFaceDetection.cpp:358
mrpt::detectors::CCascadeClassifierDetection
Definition: CCascadeClassifierDetection.h:22
mrpt::detectors::CFaceDetection::TTestsOptions::planeTest_eigenVal_top
double planeTest_eigenVal_top
Definition: CFaceDetection.h:63
mrpt::detectors::CFaceDetection::m_leave_checkIfFaceRegions
std::promise< void > m_leave_checkIfFaceRegions
Indicates to main thread that thread_checkIfFaceRegions has been completed analisis of the last face ...
Definition: CFaceDetection.h:108
mrpt::detectors::CFaceDetection::TOptions::batchMode
bool batchMode
Definition: CFaceDetection.h:56
mrpt::detectors::CFaceDetection::TMeasurement::numRealFacesDetected
int numRealFacesDetected
Definition: CFaceDetection.h:132
mrpt::detectors::CFaceDetection::TOptions::multithread
bool multithread
Definition: CFaceDetection.h:49
mrpt::detectors::CFaceDetection::m_meanHist
std::vector< double > m_meanHist
Definition: CFaceDetection.h:143
mrpt::detectors::CFaceDetection::checkIfFaceRegions
bool checkIfFaceRegions(mrpt::obs::CObservation3DRangeScan *face)
Definition: CFaceDetection.cpp:505
mrpt::math::dynamic_vector
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
Definition: eigen_frwds.h:44
mrpt::system::CTimeLogger
A versatile "profiler" that logs the time spent within each pair of calls to enter(X)-leave(X),...
Definition: system/CTimeLogger.h:43
mrpt::detectors::CFaceDetection
Specific class for face detection.
Definition: CFaceDetection.h:32
mrpt::detectors::CFaceDetection::TTestsOptions::planeTest_eigenVal_bottom
double planeTest_eigenVal_bottom
Definition: CFaceDetection.h:64
mrpt::detectors::CFaceDetection::dummy_checkIfFacePlaneCov
static void dummy_checkIfFacePlaneCov(CFaceDetection *obj)
Definition: CFaceDetection.cpp:353
mrpt::math::CMatrixTemplate< bool >
mrpt::detectors::CFaceDetection::TMeasurement::saveMeasurementsToFile
bool saveMeasurementsToFile
Definition: CFaceDetection.h:136
mrpt::detectors::CFaceDetection::dummy_checkIfFaceRegions
static void dummy_checkIfFaceRegions(CFaceDetection *obj)
Definition: CFaceDetection.cpp:481
points
GLsizei const GLfloat * points
Definition: glext.h:5339
obj
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
mrpt::detectors::CFaceDetection::m_checkIfFacePlaneCov_res
bool m_checkIfFacePlaneCov_res
Save result of checkIfFacePlaneCov filter.
Definition: CFaceDetection.h:89
mrpt::detectors::CFaceDetection::CFaceDetection
CFaceDetection()
Definition: CFaceDetection.cpp:47
mrpt::detectors::CFaceDetection::TMeasurement::meanRegions
mrpt::math::CVectorDouble meanRegions
Definition: CFaceDetection.h:125
CObjectDetection.h
mrpt::detectors::CFaceDetection::m_thread_checkIfDiagonalSurface
std::thread m_thread_checkIfDiagonalSurface
Thread that execute checkIfDiagonalSurface filter.
Definition: CFaceDetection.h:84
mrpt::detectors::CFaceDetection::~CFaceDetection
~CFaceDetection()
Definition: CFaceDetection.cpp:60
CObservation3DRangeScan.h
mrpt::detectors::CFaceDetection::m_thread_checkIfFacePlaneCov
std::thread m_thread_checkIfFacePlaneCov
Thread that execute checkIfFacePlaneCov filter.
Definition: CFaceDetection.h:82
falsePositives
vector< std::vector< uint32_t > > falsePositives
Definition: vision_stereo_rectify/test.cpp:48
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::detectors::CFaceDetection::experimental_viewFacePointsAndEigenVects
void experimental_viewFacePointsAndEigenVects(const std::vector< mrpt::math::CArrayDouble< 3 >> &pointsVector, const mrpt::math::CMatrixDouble &eigenVect, const mrpt::math::CVectorDouble &eigenVal)
Definition: CFaceDetection.cpp:1469
mrpt::detectors::CFaceDetection::TMeasurement::errorEstimations
mrpt::math::CVectorDouble errorEstimations
Definition: CFaceDetection.h:124
mrpt::detectors::CFaceDetection::TTestsOptions::regionsTest_sumDistThreshold_top
double regionsTest_sumDistThreshold_top
Definition: CFaceDetection.h:65
p
GLfloat GLfloat p
Definition: glext.h:6305
mrpt::detectors::CFaceDetection::TOptions::useDiagonalDistanceFilter
bool useDiagonalDistanceFilter
Definition: CFaceDetection.h:54
mrpt::detectors::CFaceDetection::m_checkIfDiagonalSurface_res
bool m_checkIfDiagonalSurface_res
Save result of checkIfDiagonalSurface filter.
Definition: CFaceDetection.h:91
mrpt::detectors::CFaceDetection::m_checkIfFaceRegions_res
bool m_checkIfFaceRegions_res
Save result of checkIfFaceRegions filter.
Definition: CFaceDetection.h:87
mrpt::detectors::CFaceDetection::checkIfDiagonalSurface
bool checkIfDiagonalSurface(mrpt::obs::CObservation3DRangeScan *face)
Definition: CFaceDetection.cpp:858
mrpt::detectors::CFaceDetection::TMeasurement::sumDistances
mrpt::math::CVectorDouble sumDistances
Definition: CFaceDetection.h:127
mrpt::detectors::CFaceDetection::cascadeClassifier
CCascadeClassifierDetection cascadeClassifier
Definition: CFaceDetection.h:35
mrpt::detectors::CFaceDetection::checkIfFacePlane
bool checkIfFacePlane(mrpt::obs::CObservation3DRangeScan *face)
Definition: CFaceDetection.cpp:324
mrpt::detectors::CFaceDetection::m_options
struct mrpt::detectors::CFaceDetection::TOptions m_options
mrpt::detectors::CFaceDetection::experimental_segmentFace
void experimental_segmentFace(const mrpt::obs::CObservation3DRangeScan &face, mrpt::math::CMatrixTemplate< bool > &region)
Definition: CFaceDetection.cpp:1676
mrpt::math::CMatrixTemplateNumeric< double >
mrpt::detectors::CObjectDetection
Definition: CObjectDetection.h:24
mrpt::detectors::CFaceDetection::m_end_threads
bool m_end_threads
Indicates to all threads that must finish their execution.
Definition: CFaceDetection.h:94
mrpt::detectors::CFaceDetection::thread_checkIfDiagonalSurface
void thread_checkIfDiagonalSurface()
Definition: CFaceDetection.cpp:838
mrpt::detectors::CFaceDetection::TOptions::useSizeDistanceRelationFilter
bool useSizeDistanceRelationFilter
Definition: CFaceDetection.h:53
mrpt::obs::CObservation3DRangeScan
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement,...
Definition: CObservation3DRangeScan.h:224
mrpt::detectors::CFaceDetection::TOptions::useRegionsFilter
bool useRegionsFilter
Definition: CFaceDetection.h:52
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
mrpt::detectors::CFaceDetection::TMeasurement::deletedRegions
std::vector< uint32_t > deletedRegions
Definition: CFaceDetection.h:130
mrpt::detectors::CFaceDetection::TOptions::confidenceThreshold
int confidenceThreshold
Definition: CFaceDetection.h:48
mrpt::detectors::CFaceDetection::TOptions
Definition: CFaceDetection.h:46
mrpt::detectors::CFaceDetection::init
virtual void init(const mrpt::config::CConfigFileBase &cfg)
Initialize the object with parameters loaded from the given config source.
Definition: CFaceDetection.cpp:78
mrpt::detectors::CFaceDetection::TTestsOptions::planeThreshold
double planeThreshold
Definition: CFaceDetection.h:62
mrpt::detectors::CFaceDetection::m_lastFaceDetected
mrpt::obs::CObservation3DRangeScan m_lastFaceDetected
Last face detected.
Definition: CFaceDetection.h:117
mrpt::detectors::CFaceDetection::m_testsOptions
struct mrpt::detectors::CFaceDetection::TTestsOptions m_testsOptions
obs_frwds.h
mrpt::math::CArrayNumeric
CArrayNumeric is an array for numeric types supporting several mathematical operations (actually,...
Definition: CArrayNumeric.h:25
mrpt::detectors::CFaceDetection::experimental_viewFacePointsScanned
void experimental_viewFacePointsScanned(const std::vector< float > &xs, const std::vector< float > &ys, const std::vector< float > &zs)
Definition: CFaceDetection.cpp:1399
mrpt::detectors::CFaceDetection::TMeasurement::faceNum
int faceNum
Definition: CFaceDetection.h:129
mrpt::detectors::CFaceDetection::m_enter_checkIfFacePlaneCov
std::promise< void > m_enter_checkIfFacePlaneCov
Indicates to thread_checkIfFacePlaneCov that exist a new face to analyze.
Definition: CFaceDetection.h:101
mrpt::detectors::CFaceDetection::thread_checkIfFaceRegions
void thread_checkIfFaceRegions()
Definition: CFaceDetection.cpp:486
mrpt::img::CImage
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:130
mrpt::detectors::CFaceDetection::m_thread_checkIfFaceRegions
std::thread m_thread_checkIfFaceRegions
Thread that execute checkIfFaceRegions filter.
Definition: CFaceDetection.h:80
mrpt::detectors::CFaceDetection::m_enter_checkIfDiagonalSurface
std::promise< void > m_enter_checkIfDiagonalSurface
Indicates to thread_checkIfDiagonalSurface that exist a new face to analyze.
Definition: CFaceDetection.h:104
mrpt::detectors::CFaceDetection::dummy_checkIfDiagonalSurface
static void dummy_checkIfDiagonalSurface(CFaceDetection *obj)
Definition: CFaceDetection.cpp:833
mrpt::detectors::CFaceDetection::checkIfDiagonalSurface2
bool checkIfDiagonalSurface2(mrpt::obs::CObservation3DRangeScan *face)
Definition: CFaceDetection.cpp:1125
mrpt::math::TPoint3D
Lightweight 3D point.
Definition: lightweight_geom_data.h:378
mrpt::detectors::CFaceDetection::m_enter_checkIfFaceRegions
std::promise< void > m_enter_checkIfFaceRegions
Indicates to thread_checkIfFaceRegions that exist a new face to analyze.
Definition: CFaceDetection.h:98
mrpt::detectors::vector_detectable_object
std::vector< CDetectableObject::Ptr > vector_detectable_object
Definition: CObjectDetection.h:21
CCascadeClassifierDetection.h
mrpt::detectors::CFaceDetection::m_leave_checkIfDiagonalSurface
std::promise< void > m_leave_checkIfDiagonalSurface
Indicates to main thread that thread_checkIfDiagonalSurface has been completed analisis of the last f...
Definition: CFaceDetection.h:114
CTimeLogger.h
mrpt::detectors::CFaceDetection::experimental_viewRegions
void experimental_viewRegions(const std::vector< mrpt::math::TPoint3D > regions[9], const mrpt::math::TPoint3D meanPos[3][3])
Definition: CFaceDetection.cpp:1579
mrpt::detectors::CFaceDetection::TOptions::useCovFilter
bool useCovFilter
Definition: CFaceDetection.h:51
mrpt::obs::CObservation
Declares a class that represents any robot's observation.
Definition: CObservation.h:43
mrpt::detectors::CFaceDetection::detectObjects_Impl
virtual void detectObjects_Impl(const mrpt::obs::CObservation *obs, vector_detectable_object &detected)
Definition: CFaceDetection.cpp:134
mrpt::detectors::CFaceDetection::TMeasurement::takeTime
bool takeTime
Definition: CFaceDetection.h:134
mrpt::detectors::CFaceDetection::m_measure
struct mrpt::detectors::CFaceDetection::TMeasurement m_measure
mrpt::detectors::CFaceDetection::TTestsOptions
Definition: CFaceDetection.h:60
face
GLenum GLuint GLint GLenum face
Definition: glext.h:8194
mrpt::detectors::CFaceDetection::debug_returnResults
void debug_returnResults(const std::vector< uint32_t > &falsePositives, const std::vector< uint32_t > &ignore, unsigned int &falsePositivesDeleted, unsigned int &realFacesDeleted)
Definition: CFaceDetection.cpp:2007
mrpt::detectors::CFaceDetection::TMeasurement::numPossibleFacesDetected
int numPossibleFacesDetected
Definition: CFaceDetection.h:131
mrpt::detectors::CFaceDetection::checkIfFacePlaneCov
bool checkIfFacePlaneCov(mrpt::obs::CObservation3DRangeScan *face)
Definition: CFaceDetection.cpp:376
mrpt::detectors::CFaceDetection::experimental_calcHist
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)
Definition: CFaceDetection.cpp:1846
mrpt::detectors::CFaceDetection::m_leave_checkIfFacePlaneCov
std::promise< void > m_leave_checkIfFacePlaneCov
Indicates to main thread that thread_checkIfFacePlaneCov has been completed analisis of the last face...
Definition: CFaceDetection.h:111
mrpt::detectors::CFaceDetection::experimental_showMeasurements
void experimental_showMeasurements()
Definition: CFaceDetection.cpp:1866
mrpt::detectors::CFaceDetection::TMeasurement::takeMeasures
bool takeMeasures
Definition: CFaceDetection.h:121
mrpt::detectors::CFaceDetection::m_timeLog
mrpt::system::CTimeLogger m_timeLog
Definition: CFaceDetection.h:141
mrpt::detectors::CFaceDetection::TTestsOptions::regionsTest_sumDistThreshold_bottom
double regionsTest_sumDistThreshold_bottom
Definition: CFaceDetection.h:66
mrpt::detectors::CFaceDetection::TMeasurement
Definition: CFaceDetection.h:119



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST