00001 /* 00002 * SimpleRectangleFinder.h 00003 * 00004 * Created on: Feb 20, 2010 00005 * Author: uscr 00006 */ 00007 00008 #ifndef SIMPLERECTANGLEFINDER_H_ 00009 #define SIMPLERECTANGLEFINDER_H_ 00010 00011 #include <opencv/cv.h> 00012 #include <vector> 00013 00014 #define CANNY_THRESH 100.0 00015 #define POLY_APPROX_ACCURACY 0.035 00016 #define AREA_THRESH 5000 00017 #define CV_CALIB_DFILE "cv_calib/Distortion.xml" 00018 #define CV_CALIB_IFILE "cv_calib/Intrinsics.xml" 00019 #define AR_PATT_THRESH 80 00020 #define AR_PATT_WIDTH 170 00021 00022 class SimpleRectangleFinder { 00023 public: 00024 SimpleRectangleFinder(IplImage * imgRef); 00025 virtual ~SimpleRectangleFinder(); 00026 void search(IplImage * subj, int width, int & centerx, int & centery); 00027 00028 00029 private: 00030 IplImage * edges, * ideal; 00031 CvMemStorage *storage, *approxStorage; 00032 CvSeq *contours, *polyPoints; 00033 CvMat * distortMat, * cameraMat; 00034 IplImage * mapx, * mapy; 00035 00036 std::vector<CvPoint2D32f> rectDeformCorn; 00037 std::vector<CvPoint2D32f> rectFlatCorn; 00038 double center[2]; 00039 }; 00040 00041 #endif /* SIMPLERECTANGLEFINDER_H_ */