libface 0.2
|
00001 00033 #ifndef _LIBFACEUTILS_H_ 00034 #define _LIBFACEUTILS_H_ 00035 00036 #if defined (__APPLE__) 00037 #include <highgui.h> 00038 #include <cxcore.h> 00039 #include <cv.h> 00040 #else 00041 #include <opencv/highgui.h> 00042 #include <opencv/cxcore.h> 00043 #include <opencv/cv.h> 00044 #endif 00045 00046 #include <cstdio> 00047 #include <cstdlib> 00048 #include <string> 00049 00050 #include "Face.h" 00051 00052 namespace libface 00053 { 00054 00055 class FACEAPI LibFaceUtils 00056 { 00057 public: 00058 00059 static IplImage* resizeToArea(const IplImage* img, int area, double& ratio); 00060 static CvPoint center(const Face&); 00061 static int distance(CvPoint, CvPoint); 00062 static int distance(const Face&, const Face&); 00063 00064 static CvMat* addScalar(CvMat* src, CvScalar value); 00065 static CvMat* combine(CvMat* src, CvMat* vector); 00066 static void divVec(CvMat* src, double value); 00067 static CvMat* getColoumn(CvMat* src, int col); 00068 static CvMat* mean(CvMat* src); 00069 static CvMat* multScalar(CvMat* src, double value); 00070 static void printMatrix(CvMat* src); 00071 static CvMat* reshape(CvMat* src); 00072 static CvMat* reverseOrder(CvMat* src); 00073 static void showImage(CvArr* src, const std::string& title = "Image"); 00074 static void showImage(const IplImage* img, const std::vector<Face>& faces, double scale = 1, const std::string& title = "Image"); 00075 static void sqrVec(CvMat* src); 00076 static IplImage* stringToImage(const std::string& data, int depth, int channels); 00077 static CvMat* stringToMatrix(const std::string& data, int type); 00078 static CvMat* subtract(CvMat* src1, CvMat* src2); 00079 static double sumVecToDouble(CvMat* src); 00080 static CvMat* transpose(CvMat* src); 00081 static IplImage* charToIplImage(const char* img, int width, int height, int step, int depth, int channels); 00082 static IplImage* copyRect(const IplImage* src, const CvRect& rect); 00083 static IplImage* scaledSection(const IplImage* src, const CvRect& sourceRect, double scaleFactor); 00084 static IplImage* scaledSection(const IplImage* src, const CvRect& sourceRect, const CvSize& destSize); 00085 00086 static std::string imageToString(IplImage* src); 00087 static std::string matrixToString(CvMat* src); 00088 }; 00089 00090 } // namespace libface 00091 00092 #endif // _LIBFACEUTILS_H_