libface 0.2
|
00001 00035 #ifndef _LIBFACE_H_ 00036 #define _LIBFACE_H_ 00037 00038 #include "Eigenfaces.h" 00039 #include "LibFaceConfig.h" 00040 #include "LibFaceCore.h" 00041 00042 namespace libface { 00043 00046 enum Mode { 00047 ALL, 00048 DETECT, 00049 EIGEN 00050 }; 00051 00052 class FACEAPI LibFace { 00053 00054 public: 00055 00068 #ifdef WIN32 00069 LibFace(Mode type = ALL, const std::string& configDir = ".", const std::string& cascadeDir = std::string(OPENCVDIR)+"/data/haarcascades"); 00070 #else 00071 LibFace(Mode type = ALL, const std::string& configDir = ".", const std::string& cascadeDir = std::string(OPENCVDIR)+"/haarcascades"); 00072 #endif 00073 00077 ~LibFace(); 00078 00079 // OpenCV compatibility methods 00080 00084 int count() const; 00085 00086 00097 std::vector<Face>* detectFaces(const IplImage* img, const CvSize& originalSize); 00098 // API-agnostic methods 00099 00111 std::vector<Face>* detectFaces(const std::string& filename, int scaleFactor=1); 00112 00128 std::vector<Face>* detectFaces(const char* image, int width , int height , int step , int depth = IPL_DEPTH_8U, int channels = 1, int scaleFactor=1 ); 00129 00130 00131 00142 std::map<std::string, std::string> getConfig(); 00143 00147 double getDetectionAccuracy() const; 00148 00155 int getRecommendedImageSizeForDetection(const CvSize& size = cvSize(0,0)) const; 00156 00163 CvSize getRecommendedImageSizeForRecognition(const CvSize& size = cvSize(0,0)) const; 00164 00172 int loadConfig(const std::string& configDir); 00173 00183 int loadConfig(const std::map<std::string, std::string>& config); 00184 00185 std::vector<std::pair<int, float> > recognise(const IplImage* img, std::vector<Face>* faces_p, int scaleFactor=1); 00186 00187 00198 std::vector<std::pair<int, float> > recognise(const std::string& filename, std::vector<Face>* faces_p, int scaleFactor=1); 00199 00210 std::vector<std::pair<int, float> > recognise(const char* image, std::vector<Face>* faces_p, int width, int height, int step, int depth = IPL_DEPTH_8U, int channels = 1, int scaleFactor=1); 00211 00221 std::vector<std::pair<int, float> > recognise( std::vector<Face>* faces, int scaleFactor =1); 00222 00223 00232 int saveConfig(const std::string& configDir); 00233 00239 void setDetectionAccuracy(double value); 00240 00241 00251 int update(const std::string& filename, std::vector<Face>* faces=NULL, int scaleFactor=1); 00252 00267 int update(const char* image, std::vector<Face>* faces, int width , int height , int step , int depth = IPL_DEPTH_8U, int channels = 1, int scaleFactor=1); 00268 00278 int update(std::vector<Face>* faces=NULL, int scaleFactor=1); 00279 00288 int update(const IplImage* img, std::vector<Face>* faces, int scaleFactor = 1); 00289 00290 private: 00291 00292 class LibFacePriv; 00293 LibFacePriv* const d; 00294 }; 00295 00296 } // namespace libface 00297 00298 #endif /* _LIBFACE_H_ */