Main MRPT website > C++ reference
MRPT logo
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-2014, 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 
15 #include <mrpt/utils/CTimeLogger.h>
16 #include <mrpt/system/threads.h>
17 #include <mrpt/synch.h>
19 
20 namespace mrpt
21 {
22 
23  namespace slam { class CObservation3DRangeScan; }
24 
25  /** \ingroup mrpt_detectors_grp */
26  namespace detectors
27  {
28  using namespace mrpt::slam;
29  using namespace mrpt::system;
30  using namespace mrpt::synch;
31  using namespace mrpt::math;
32 
33  /** Specific class for face detection.
34  * Methods and variables labeled as experimentals are temporals (for debug or testing
35  * purposes) and may disappear in future versions.
36  * \ingroup mrpt_detectors_grp
37  */
39  {
40  public:
41 
43 
45 
46  ~CFaceDetection();
47 
48  virtual void init(const mrpt::utils::CConfigFileBase &cfg );
49 
50  virtual void detectObjects_Impl(const CObservation *obs, vector_detectable_object &detected);
51 
52  struct TOptions
53  {
56 
61 
62  bool batchMode;
63 
64  }m_options;
65 
67  {
73 
74  }m_testsOptions;
75 
76  // Experimental methods
77  void experimental_showMeasurements();
78 
79  void debug_returnResults( const vector_uint &falsePositives, const vector_uint &ignore, unsigned int &falsePositivesDeleted, unsigned int &realFacesDeleted );
80 
81  private:
82 
83  TThreadHandle m_thread_checkIfFaceRegions; //!< Thread that execute checkIfFaceRegions filter
84  TThreadHandle m_thread_checkIfFacePlaneCov; //!< Thread that execute checkIfFacePlaneCov filter
85  TThreadHandle m_thread_checkIfDiagonalSurface; //!< Thread that execute checkIfDiagonalSurface filter
86 
87  bool m_checkIfFaceRegions_res; //!< Save result of checkIfFaceRegions filter
88  bool m_checkIfFacePlaneCov_res; //!< Save result of checkIfFacePlaneCov filter
89  bool m_checkIfDiagonalSurface_res; //!< Save result of checkIfDiagonalSurface filter
90 
91  bool m_end_threads; //!< Indicates to all threads that must finish their execution
92 
93  CSemaphore m_enter_checkIfFaceRegions; //!< Indicates to thread_checkIfFaceRegions that exist a new face to analyze
94  CSemaphore m_enter_checkIfFacePlaneCov; //!< Indicates to thread_checkIfFacePlaneCov that exist a new face to analyze
95  CSemaphore m_enter_checkIfDiagonalSurface; //!< Indicates to thread_checkIfDiagonalSurface that exist a new face to analyze
96 
97  CSemaphore m_leave_checkIfFaceRegions; //!< Indicates to main thread that thread_checkIfFaceRegions has been completed analisis of the last face detected
98  CSemaphore m_leave_checkIfFacePlaneCov; //!< Indicates to main thread that thread_checkIfFacePlaneCov has been completed analisis of the last face detected
99  CSemaphore m_leave_checkIfDiagonalSurface; //!< Indicates to main thread that thread_checkIfDiagonalSurface has been completed analisis of the last face detected
100 
102 
104  {
106 
110 
112 
113  int faceNum;
117 
118  bool takeTime;
119 
121 
122  }m_measure;
123 
124  // To take measures abaout execution time
126 
127  std::vector<double> m_meanHist;
128 
129 
130  // Test to check if a candidate region is a real face
131 
132  bool checkIfFacePlane( CObservation3DRangeScan* face );
133 
134  bool checkIfFacePlaneCov( CObservation3DRangeScan* face );
135 
136  void thread_checkIfFacePlaneCov( );
137 
138  static void dummy_checkIfFacePlaneCov( CFaceDetection *obj );
139 
140 
141  bool checkIfFaceRegions( CObservation3DRangeScan* face );
142 
143  void thread_checkIfFaceRegions( );
144 
145  static void dummy_checkIfFaceRegions( CFaceDetection *obj );
146 
147  size_t checkRelativePosition( const TPoint3D &p1, const TPoint3D &p2, const TPoint3D &p, double &dist );
148 
149 
150  void thread_checkIfDiagonalSurface( );
151 
152  bool checkIfDiagonalSurface( CObservation3DRangeScan* face );
153 
154  bool checkIfDiagonalSurface2( CObservation3DRangeScan* face );
155 
156  static void dummy_checkIfDiagonalSurface( CFaceDetection *obj );
157 
158  // Experimental methods to view 3D points
159 
160  void experimental_viewFacePointsScanned( const std::vector<float> &xs, const std::vector<float> &ys, const std::vector<float> &zs );
161 
162  void experimental_viewFacePointsScanned( const CObservation3DRangeScan &face );
163 
164  void experimental_viewFacePointsScanned( const std::vector<TPoint3D> &points );
165 
166  void experimental_viewFacePointsAndEigenVects( const std::vector<CArrayDouble<3> > &pointsVector, const CMatrixDouble &eigenVect, const CVectorDouble &eigenVal );
167 
168  void experimental_viewRegions( const std::vector<TPoint3D> regions[9], const TPoint3D meanPos[3][3] );
169 
170  // Segmentation methods
171 
172  void experimental_segmentFace( const CObservation3DRangeScan &face, CMatrixTemplate<bool> &region );
173 
174  // Histogram methods
175 
176  void experimental_calcHist( const CImage &face, const size_t &c1, const size_t &r1, const size_t &c2,
177  const size_t &r2, CMatrixTemplate<unsigned int> &hist );
178 
179 
180 
181  }; // End of class
182  }
183 
184 }
185 
186 #endif
bool m_end_threads
Indicates to all threads that must finish their execution.
CCascadeClassifierDetection cascadeClassifier
bool m_checkIfFaceRegions_res
Save result of checkIfFaceRegions filter.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
Definition: math_frwds.h:30
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:97
std::vector< CDetectableObjectPtr > vector_detectable_object
CSemaphore m_leave_checkIfFacePlaneCov
Indicates to main thread that thread_checkIfFacePlaneCov has been completed analisis of the last face...
std::vector< double > m_meanHist
CSemaphore m_leave_checkIfFaceRegions
Indicates to main thread that thread_checkIfFaceRegions has been completed analisis of the last face ...
CSemaphore m_leave_checkIfDiagonalSurface
Indicates to main thread that thread_checkIfDiagonalSurface has been completed analisis of the last f...
This namespace contains algorithms for SLAM, localization, map building, representation of robot's ac...
TThreadHandle m_thread_checkIfDiagonalSurface
Thread that execute checkIfDiagonalSurface filter.
This class allows loading and storing values and vectors of different types from a configuration text...
This base provides a set of functions for maths stuff.
Definition: CArray.h:18
TThreadHandle m_thread_checkIfFaceRegions
Thread that execute checkIfFaceRegions filter.
std::vector< uint32_t > vector_uint
Declares a class that represents any robot's observation.
Definition: CObservation.h:52
CObservation3DRangeScan m_lastFaceDetected
Last face detected.
Specific class for face detection.
This namespace provides multitask, synchronization utilities.
Definition: atomic_incr.h:18
This template class provides the basic functionality for a general 2D any-size, resizable container o...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CSemaphore m_enter_checkIfFaceRegions
Indicates to thread_checkIfFaceRegions that exist a new face to analyze.
This structure contains the information needed to interface the threads API on each platform: ...
Definition: threads.h:25
CSemaphore m_enter_checkIfFacePlaneCov
Indicates to thread_checkIfFacePlaneCov that exist a new face to analyze.
A versatile "profiler" that logs the time spent within each pair of calls to enter(X)-leave(X), among other stats.
Definition: CTimeLogger.h:35
dynamic_vector< double > CVectorDouble
Column vector, like Eigen::MatrixXd, but automatically initialized to zeros since construction...
Definition: eigen_frwds.h:53
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement (e...
CSemaphore m_enter_checkIfDiagonalSurface
Indicates to thread_checkIfDiagonalSurface that exist a new face to analyze.
Lightweight 3D point.
TThreadHandle m_thread_checkIfFacePlaneCov
Thread that execute checkIfFacePlaneCov filter.
bool m_checkIfDiagonalSurface_res
Save result of checkIfDiagonalSurface filter.
A semaphore for inter-thread synchronization.
Definition: CSemaphore.h:31
bool m_checkIfFacePlaneCov_res
Save result of checkIfFacePlaneCov filter.



Page generated by Doxygen 1.8.8 for MRPT 1.2.2 SVN:Unversioned directory at Tue Oct 14 02:14:08 UTC 2014