$search
00001 00002 00003 00004 00005 00006 #ifndef __PEOPLEDETECTORCONTROLFLOW_H__ 00007 #define __PEOPLEDETECTORCONTROLFLOW_H__ 00008 00009 00010 #ifdef __LINUX__ 00011 #include "cob_sensor_fusion/CameraSensorsControlFlow.h" 00012 #include "cob_vision_ipa_utils/MathUtils.h" 00013 #include "cob_people_detection/PeopleDetector.h" 00014 #else 00015 #include "cob_vision/cob_sensor_fusion/common/include/cob_sensor_fusion/CameraSensorsControlFlow.h" 00016 #include "cob_vision/cob_vision_ipa_utils/common/include/cob_vision_ipa_utils/MathUtils.h" 00017 #include "cob_vision/cob_people_detection/common/include/cob_people_detection/PeopleDetector.h" 00018 #endif 00019 00020 #include <iostream> 00021 #include <cv.h> 00022 #include <string> 00023 #include <vector> 00024 #include <cvaux.h> 00025 #include <sstream> 00026 00027 #include "boost/filesystem/operations.hpp" 00028 #include "boost/filesystem/convenience.hpp" 00029 #include "boost/filesystem/path.hpp" 00030 00031 namespace fs = boost::filesystem; 00032 00033 namespace ipa_PeopleDetector { 00034 00036 class PeopleDetectorControlFlow : public CameraSensorsControlFlow 00037 { 00038 public: 00040 PeopleDetectorControlFlow(void); 00041 ~PeopleDetectorControlFlow(void); 00042 00051 unsigned long Init(std::string directory, 00052 ipa_CameraSensors::AbstractColorCameraPtr* colorCamera0 = 0, 00053 ipa_CameraSensors::AbstractColorCameraPtr* colorCamera1 = 0, 00054 ipa_CameraSensors::AbstractRangeImagingSensorPtr* rangeImagingSensor = 0); 00055 00059 unsigned long DetectFaces(ipa_SensorFusion::ColoredPointCloudPtr pc); 00060 00065 unsigned long AddFace(cv::Mat& image, std::string id); 00066 00069 unsigned long PCA(); 00070 00076 unsigned long RecognizeFace(ipa_SensorFusion::ColoredPointCloudPtr pc, std::vector<int>& index); 00077 00080 unsigned long SaveTrainingData(); 00081 00084 unsigned long LoadTrainingData(); 00085 00090 unsigned long GetEigenface(cv::Mat& eigenface, int index); 00091 00095 unsigned long ShowAVGImage(cv::Mat& avgImage); 00096 00100 unsigned long SaveRangeTrainImages(ipa_SensorFusion::ColoredPointCloudPtr pc); 00101 00105 unsigned long LoadParameters(const char* iniFileName); 00106 00109 ColoredPointCloudToolbox::t_PointCloudMode GetPCMode() { return m_PCMode; }; 00110 00111 ipa_SensorFusion::ColoredPointCloudToolbox* m_pcToolbox; 00112 00113 std::vector<cv::Mat> m_faceImages; 00114 std::vector<std::string> m_id; 00115 std::vector<std::string> m_idUnique; 00116 00117 int m_nEigens; 00118 std::vector<cv::Mat> m_eigenVectors; 00119 cv::Mat m_eigenValMat; 00120 cv::Mat m_avgImage; 00121 cv::Mat m_projectedTrainFaceMat; 00122 cv::Mat m_faceClassAvgProjections; 00123 00124 PeopleDetector* m_PeopleDetector; 00125 int m_threshold; 00126 int m_threshold_FS; 00127 std::vector<cv::Rect> m_colorFaces; 00128 std::vector<cv::Rect> m_rangeFaces; 00129 00130 int m_OpenGL; 00131 int m_RangeCamIterations; 00132 00133 private: 00134 bool m_runPCA; 00135 00136 ipa_CameraSensors::AbstractRangeImagingSensor* m_RangeImagingSensor; 00137 ipa_CameraSensors::AbstractColorCamera* m_ColorCamera0; 00138 ipa_CameraSensors::AbstractColorCamera* m_ColorCamera1; 00139 00140 ipa_CameraSensors::CameraSensorToolbox* m_RangeSensorToolbox; 00141 ipa_CameraSensors::CameraSensorToolbox* m_ColorSensor0Toolbox; 00142 ipa_CameraSensors::CameraSensorToolbox* m_ColorSensor1Toolbox; 00143 00144 int m_rangeSensorWidth; 00145 int m_rangeSensorHeight; 00146 int m_filname; 00147 }; 00148 00149 } // end namespace 00150 00151 #endif // __PEOPLEDETECTORCONTROLFLOW_H__