00001
00022 #ifndef IMAGEUTILITY_H
00023 #define IMAGEUTILITY_H
00024
00025 #include "cv.h"
00026 #include "highgui.h"
00027 #include "Masek.h"
00028
00029 #include <iostream>
00030 using namespace std;
00031
00032
00033 #define NIR_IRIS_STILL 1 /// Classical still: Near-infrared iris still image.
00034 #define NIR_FACE_VIDEO 2 /// Distant video: Near-infrared face video image.
00035
00036
00037
00038
00040 #define GRAY_LEVEL 256
00041
00045 class ImageUtility
00046 {
00047 public:
00051 typedef struct
00052 {
00053 CvRect rect;
00054 CvPoint p;
00055 } SETVALUE;
00056
00064 static float myMean(IplImage* img, double n);
00065
00075 static float mySD(IplImage* img, double n, float mean);
00076
00085 static void showImage(const char* name, IplImage* img);
00086
00102 static void showCircles(const char* name, IplImage* img, const char* eyeFileName,
00103 CvPoint xyPupil, int rPupil, CvPoint xyIris, int rIris,
00104 int* ellipseVal, double* angleVal);
00105
00106
00117 static void drawCross(IplImage* eyeImg, int centerx, int centery,
00118 int xCrossLength, int yCrossLength, CvScalar color);
00119
00128 static IplImage* convertToGray(IplImage* img);
00129
00139 static Masek::IMAGE* convertIplToImage(IplImage* iplImg);
00140
00150 static IplImage* convertImageToIpl(Masek::IMAGE* image);
00151
00152
00164 static char* SaveEyeImages(IplImage* img, char* fileName, const char* ch);
00165
00179 static void SaveImageOptions(IplImage* img, char* fileName, int frame, const char* str, int num, int totalFrame);
00180
00194 static IplImage* extractImagePart(IplImage* img, CvRect& rect, int x, int y, int wd, int ht);
00195
00196
00208 static IplImage* getROIImage(IplImage* eyeImg, int startX, int endX, int startY, int endY);
00209
00221 static Masek::IMAGE* getROIImage_C(Masek::IMAGE* eyeImg, int startX, int endX, int startY, int endY);
00222
00234 static SETVALUE setImage(IplImage* eyeImg, CvPoint center, int cr, int xLimit, int yLimit);
00235
00245 static void myRect(IplImage* img, int x, int y, int radius, int* destVal);
00246
00257 static void myXYRect(IplImage* img, int x, int y, int width, int height, int* destVal);
00258
00268 static void myRect_C(Masek::IMAGE *lidImg, int x, int y, int radius, int* destVal);
00269
00277 static int getValue(int value, int maxSize);
00278 };
00279
00280 #endif // !IMAGEUTILITY_H