00001 /*M/////////////////////////////////////////////////////////////////////////////////////// 00002 // 00003 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 00004 // 00005 // By downloading, copying, installing or using the software you agree to this license. 00006 // If you do not agree to this license, do not download, install, 00007 // copy or use the software. 00008 // 00009 // 00010 // License Agreement 00011 // For Open Source Computer Vision Library 00012 // 00013 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 00014 // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 00015 // Third party copyrights are property of their respective owners. 00016 // 00017 // Redistribution and use in source and binary forms, with or without modification, 00018 // are permitted provided that the following conditions are met: 00019 // 00020 // * Redistribution's of source code must retain the above copyright notice, 00021 // this list of conditions and the following disclaimer. 00022 // 00023 // * Redistribution's in binary form must reproduce the above copyright notice, 00024 // this list of conditions and the following disclaimer in the documentation 00025 // and/or other materials provided with the distribution. 00026 // 00027 // * The name of the copyright holders may not be used to endorse or promote products 00028 // derived from this software without specific prior written permission. 00029 // 00030 // This software is provided by the copyright holders and contributors "as is" and 00031 // any express or implied warranties, including, but not limited to, the implied 00032 // warranties of merchantability and fitness for a particular purpose are disclaimed. 00033 // In no event shall the Intel Corporation or contributors be liable for any direct, 00034 // indirect, incidental, special, exemplary, or consequential damages 00035 // (including, but not limited to, procurement of substitute goods or services; 00036 // loss of use, data, or profits; or business interruption) however caused 00037 // and on any theory of liability, whether in contract, strict liability, 00038 // or tort (including negligence or otherwise) arising in any way out of 00039 // the use of this software, even if advised of the possibility of such damage. 00040 // 00041 //M*/ 00042 00043 #ifndef __OPENCV_OBJDETECT_HPP__ 00044 #define __OPENCV_OBJDETECT_HPP__ 00045 00046 #include "opencv2/core/core.hpp" 00047 #include "opencv2/features2d/features2d.hpp" 00048 00049 #ifdef __cplusplus 00050 extern "C" { 00051 #endif 00052 00053 /****************************************************************************************\ 00054 * Haar-like Object Detection functions * 00055 \****************************************************************************************/ 00056 00057 #define CV_HAAR_MAGIC_VAL 0x42500000 00058 #define CV_TYPE_NAME_HAAR "opencv-haar-classifier" 00059 00060 #define CV_IS_HAAR_CLASSIFIER( haar ) \ 00061 ((haar) != NULL && \ 00062 (((const CvHaarClassifierCascade*)(haar))->flags & CV_MAGIC_MASK)==CV_HAAR_MAGIC_VAL) 00063 00064 #define CV_HAAR_FEATURE_MAX 3 00065 00066 typedef struct CvHaarFeature 00067 { 00068 int tilted; 00069 struct 00070 { 00071 CvRect r; 00072 float weight; 00073 } rect[CV_HAAR_FEATURE_MAX]; 00074 } CvHaarFeature; 00075 00076 typedef struct CvHaarClassifier 00077 { 00078 int count; 00079 CvHaarFeature* haar_feature; 00080 float* threshold; 00081 int* left; 00082 int* right; 00083 float* alpha; 00084 } CvHaarClassifier; 00085 00086 typedef struct CvHaarStageClassifier 00087 { 00088 int count; 00089 float threshold; 00090 CvHaarClassifier* classifier; 00091 00092 int next; 00093 int child; 00094 int parent; 00095 } CvHaarStageClassifier; 00096 00097 typedef struct CvHidHaarClassifierCascade CvHidHaarClassifierCascade; 00098 00099 typedef struct CvHaarClassifierCascade 00100 { 00101 int flags; 00102 int count; 00103 CvSize orig_window_size; 00104 CvSize real_window_size; 00105 double scale; 00106 CvHaarStageClassifier* stage_classifier; 00107 CvHidHaarClassifierCascade* hid_cascade; 00108 } CvHaarClassifierCascade; 00109 00110 typedef struct CvAvgComp 00111 { 00112 CvRect rect; 00113 int neighbors; 00114 } CvAvgComp; 00115 00116 /* Loads haar classifier cascade from a directory. 00117 It is obsolete: convert your cascade to xml and use cvLoad instead */ 00118 CVAPI(CvHaarClassifierCascade*) cvLoadHaarClassifierCascade( 00119 const char* directory, CvSize orig_window_size); 00120 00121 CVAPI(void) cvReleaseHaarClassifierCascade( CvHaarClassifierCascade** cascade ); 00122 00123 #define CV_HAAR_DO_CANNY_PRUNING 1 00124 #define CV_HAAR_SCALE_IMAGE 2 00125 #define CV_HAAR_FIND_BIGGEST_OBJECT 4 00126 #define CV_HAAR_DO_ROUGH_SEARCH 8 00127 00128 //CVAPI(CvSeq*) cvHaarDetectObjectsForROC( const CvArr* image, 00129 // CvHaarClassifierCascade* cascade, CvMemStorage* storage, 00130 // CvSeq** rejectLevels, CvSeq** levelWeightds, 00131 // double scale_factor CV_DEFAULT(1.1), 00132 // int min_neighbors CV_DEFAULT(3), int flags CV_DEFAULT(0), 00133 // CvSize min_size CV_DEFAULT(cvSize(0,0)), CvSize max_size CV_DEFAULT(cvSize(0,0)), 00134 // bool outputRejectLevels = false ); 00135 00136 00137 CVAPI(CvSeq*) cvHaarDetectObjects( const CvArr* image, 00138 CvHaarClassifierCascade* cascade, CvMemStorage* storage, 00139 double scale_factor CV_DEFAULT(1.1), 00140 int min_neighbors CV_DEFAULT(3), int flags CV_DEFAULT(0), 00141 CvSize min_size CV_DEFAULT(cvSize(0,0)), CvSize max_size CV_DEFAULT(cvSize(0,0))); 00142 00143 /* sets images for haar classifier cascade */ 00144 CVAPI(void) cvSetImagesForHaarClassifierCascade( CvHaarClassifierCascade* cascade, 00145 const CvArr* sum, const CvArr* sqsum, 00146 const CvArr* tilted_sum, double scale ); 00147 00148 /* runs the cascade on the specified window */ 00149 CVAPI(int) cvRunHaarClassifierCascade( const CvHaarClassifierCascade* cascade, 00150 CvPoint pt, int start_stage CV_DEFAULT(0)); 00151 00152 00153 /****************************************************************************************\ 00154 * Latent SVM Object Detection functions * 00155 \****************************************************************************************/ 00156 00157 // DataType: STRUCT position 00158 // Structure describes the position of the filter in the feature pyramid 00159 // l - level in the feature pyramid 00160 // (x, y) - coordinate in level l 00161 typedef struct 00162 { 00163 unsigned int x; 00164 unsigned int y; 00165 unsigned int l; 00166 } CvLSVMFilterPosition; 00167 00168 // DataType: STRUCT filterObject 00169 // Description of the filter, which corresponds to the part of the object 00170 // V - ideal (penalty = 0) position of the partial filter 00171 // from the root filter position (V_i in the paper) 00172 // penaltyFunction - vector describes penalty function (d_i in the paper) 00173 // pf[0] * x + pf[1] * y + pf[2] * x^2 + pf[3] * y^2 00174 // FILTER DESCRIPTION 00175 // Rectangular map (sizeX x sizeY), 00176 // every cell stores feature vector (dimension = p) 00177 // H - matrix of feature vectors 00178 // to set and get feature vectors (i,j) 00179 // used formula H[(j * sizeX + i) * p + k], where 00180 // k - component of feature vector in cell (i, j) 00181 // END OF FILTER DESCRIPTION 00182 // xp - auxillary parameter for internal use 00183 // size of row in feature vectors 00184 // (yp = (int) (p / xp); p = xp * yp) 00185 typedef struct{ 00186 CvLSVMFilterPosition V; 00187 float fineFunction[4]; 00188 unsigned int sizeX; 00189 unsigned int sizeY; 00190 unsigned int p; 00191 unsigned int xp; 00192 float *H; 00193 } CvLSVMFilterObject; 00194 00195 // data type: STRUCT CvLatentSvmDetector 00196 // structure contains internal representation of trained Latent SVM detector 00197 // num_filters - total number of filters (root plus part) in model 00198 // num_components - number of components in model 00199 // num_part_filters - array containing number of part filters for each component 00200 // filters - root and part filters for all model components 00201 // b - biases for all model components 00202 // score_threshold - confidence level threshold 00203 typedef struct CvLatentSvmDetector 00204 { 00205 int num_filters; 00206 int num_components; 00207 int* num_part_filters; 00208 CvLSVMFilterObject** filters; 00209 float* b; 00210 float score_threshold; 00211 } 00212 CvLatentSvmDetector; 00213 00214 // data type: STRUCT CvObjectDetection 00215 // structure contains the bounding box and confidence level for detected object 00216 // rect - bounding box for a detected object 00217 // score - confidence level 00218 typedef struct CvObjectDetection 00219 { 00220 CvRect rect; 00221 float score; 00222 } CvObjectDetection; 00223 00225 00226 00227 /* 00228 // load trained detector from a file 00229 // 00230 // API 00231 // CvLatentSvmDetector* cvLoadLatentSvmDetector(const char* filename); 00232 // INPUT 00233 // filename - path to the file containing the parameters of 00234 - trained Latent SVM detector 00235 // OUTPUT 00236 // trained Latent SVM detector in internal representation 00237 */ 00238 CVAPI(CvLatentSvmDetector*) cvLoadLatentSvmDetector(const char* filename); 00239 00240 /* 00241 // release memory allocated for CvLatentSvmDetector structure 00242 // 00243 // API 00244 // void cvReleaseLatentSvmDetector(CvLatentSvmDetector** detector); 00245 // INPUT 00246 // detector - CvLatentSvmDetector structure to be released 00247 // OUTPUT 00248 */ 00249 CVAPI(void) cvReleaseLatentSvmDetector(CvLatentSvmDetector** detector); 00250 00251 /* 00252 // find rectangular regions in the given image that are likely 00253 // to contain objects and corresponding confidence levels 00254 // 00255 // API 00256 // CvSeq* cvLatentSvmDetectObjects(const IplImage* image, 00257 // CvLatentSvmDetector* detector, 00258 // CvMemStorage* storage, 00259 // float overlap_threshold = 0.5f, 00260 // int numThreads = -1); 00261 // INPUT 00262 // image - image to detect objects in 00263 // detector - Latent SVM detector in internal representation 00264 // storage - memory storage to store the resultant sequence 00265 // of the object candidate rectangles 00266 // overlap_threshold - threshold for the non-maximum suppression algorithm 00267 = 0.5f [here will be the reference to original paper] 00268 // OUTPUT 00269 // sequence of detected objects (bounding boxes and confidence levels stored in CvObjectDetection structures) 00270 */ 00271 CVAPI(CvSeq*) cvLatentSvmDetectObjects(IplImage* image, 00272 CvLatentSvmDetector* detector, 00273 CvMemStorage* storage, 00274 float overlap_threshold CV_DEFAULT(0.5f), 00275 int numThreads CV_DEFAULT(-1)); 00276 00277 #ifdef __cplusplus 00278 } 00279 00280 CV_EXPORTS CvSeq* cvHaarDetectObjectsForROC( const CvArr* image, 00281 CvHaarClassifierCascade* cascade, CvMemStorage* storage, 00282 std::vector<int>& rejectLevels, std::vector<double>& levelWeightds, 00283 double scale_factor CV_DEFAULT(1.1), 00284 int min_neighbors CV_DEFAULT(3), int flags CV_DEFAULT(0), 00285 CvSize min_size CV_DEFAULT(cvSize(0,0)), CvSize max_size CV_DEFAULT(cvSize(0,0)), 00286 bool outputRejectLevels = false ); 00287 00288 namespace cv 00289 { 00290 00292 00293 CV_EXPORTS_W void groupRectangles(vector<Rect>& rectList, int groupThreshold, double eps=0.2); 00294 CV_EXPORTS_W void groupRectangles(vector<Rect>& rectList, CV_OUT vector<int>& weights, int groupThreshold, double eps=0.2); 00295 CV_EXPORTS void groupRectangles(vector<Rect>& rectList, vector<int>& rejectLevels, 00296 vector<double>& levelWeights, int groupThreshold, double eps=0.2); 00297 CV_EXPORTS void groupRectangles_meanshift(vector<Rect>& rectList, vector<double>& foundWeights, vector<double>& foundScales, 00298 double detectThreshold = 0.0, Size winDetSize = Size(64, 128)); 00299 00300 00301 class CV_EXPORTS FeatureEvaluator 00302 { 00303 public: 00304 enum { HAAR = 0, LBP = 1 }; 00305 virtual ~FeatureEvaluator(); 00306 00307 virtual bool read(const FileNode& node); 00308 virtual Ptr<FeatureEvaluator> clone() const; 00309 virtual int getFeatureType() const; 00310 00311 virtual bool setImage(const Mat&, Size origWinSize); 00312 virtual bool setWindow(Point p); 00313 00314 virtual double calcOrd(int featureIdx) const; 00315 virtual int calcCat(int featureIdx) const; 00316 00317 static Ptr<FeatureEvaluator> create(int type); 00318 }; 00319 00320 template<> CV_EXPORTS void Ptr<CvHaarClassifierCascade>::delete_obj(); 00321 00322 class CV_EXPORTS_W CascadeClassifier 00323 { 00324 public: 00325 CV_WRAP CascadeClassifier(); 00326 CV_WRAP CascadeClassifier( const string& filename ); 00327 virtual ~CascadeClassifier(); 00328 00329 CV_WRAP virtual bool empty() const; 00330 CV_WRAP bool load( const string& filename ); 00331 virtual bool read( const FileNode& node ); 00332 CV_WRAP virtual void detectMultiScale( const Mat& image, 00333 CV_OUT vector<Rect>& objects, 00334 double scaleFactor=1.1, 00335 int minNeighbors=3, int flags=0, 00336 Size minSize=Size(), 00337 Size maxSize=Size() ); 00338 00339 CV_WRAP virtual void detectMultiScale( const Mat& image, 00340 CV_OUT vector<Rect>& objects, 00341 vector<int>& rejectLevels, 00342 vector<double>& levelWeights, 00343 double scaleFactor=1.1, 00344 int minNeighbors=3, int flags=0, 00345 Size minSize=Size(), 00346 Size maxSize=Size(), 00347 bool outputRejectLevels=false ); 00348 00349 00350 bool isOldFormatCascade() const; 00351 virtual Size getOriginalWindowSize() const; 00352 int getFeatureType() const; 00353 bool setImage( const Mat& ); 00354 00355 protected: 00356 //virtual bool detectSingleScale( const Mat& image, int stripCount, Size processingRectSize, 00357 // int stripSize, int yStep, double factor, vector<Rect>& candidates ); 00358 00359 virtual bool detectSingleScale( const Mat& image, int stripCount, Size processingRectSize, 00360 int stripSize, int yStep, double factor, vector<Rect>& candidates, 00361 vector<int>& rejectLevels, vector<double>& levelWeights, bool outputRejectLevels=false); 00362 00363 protected: 00364 enum { BOOST = 0 }; 00365 enum { DO_CANNY_PRUNING = 1, SCALE_IMAGE = 2, 00366 FIND_BIGGEST_OBJECT = 4, DO_ROUGH_SEARCH = 8 }; 00367 00368 friend struct CascadeClassifierInvoker; 00369 00370 template<class FEval> 00371 friend int predictOrdered( CascadeClassifier& cascade, Ptr<FeatureEvaluator> &featureEvaluator, double& weight); 00372 00373 template<class FEval> 00374 friend int predictCategorical( CascadeClassifier& cascade, Ptr<FeatureEvaluator> &featureEvaluator, double& weight); 00375 00376 template<class FEval> 00377 friend int predictOrderedStump( CascadeClassifier& cascade, Ptr<FeatureEvaluator> &featureEvaluator, double& weight); 00378 00379 template<class FEval> 00380 friend int predictCategoricalStump( CascadeClassifier& cascade, Ptr<FeatureEvaluator> &featureEvaluator, double& weight); 00381 00382 bool setImage( Ptr<FeatureEvaluator>&, const Mat& ); 00383 virtual int runAt( Ptr<FeatureEvaluator>&, Point, double& weight ); 00384 00385 class Data 00386 { 00387 public: 00388 struct CV_EXPORTS DTreeNode 00389 { 00390 int featureIdx; 00391 float threshold; // for ordered features only 00392 int left; 00393 int right; 00394 }; 00395 00396 struct CV_EXPORTS DTree 00397 { 00398 int nodeCount; 00399 }; 00400 00401 struct CV_EXPORTS Stage 00402 { 00403 int first; 00404 int ntrees; 00405 float threshold; 00406 }; 00407 00408 bool read(const FileNode &node); 00409 00410 bool isStumpBased; 00411 00412 int stageType; 00413 int featureType; 00414 int ncategories; 00415 Size origWinSize; 00416 00417 vector<Stage> stages; 00418 vector<DTree> classifiers; 00419 vector<DTreeNode> nodes; 00420 vector<float> leaves; 00421 vector<int> subsets; 00422 }; 00423 00424 Data data; 00425 Ptr<FeatureEvaluator> featureEvaluator; 00426 Ptr<CvHaarClassifierCascade> oldCascade; 00427 }; 00428 00429 void CV_EXPORTS_W groupRectangles( vector<Rect>& rectList, int groupThreshold, double eps, vector<int>* weights, vector<double>* levelWeights ); 00430 00432 00433 struct CV_EXPORTS_W HOGDescriptor 00434 { 00435 public: 00436 enum { L2Hys=0 }; 00437 enum { DEFAULT_NLEVELS=64 }; 00438 00439 CV_WRAP HOGDescriptor() : winSize(64,128), blockSize(16,16), blockStride(8,8), 00440 cellSize(8,8), nbins(9), derivAperture(1), winSigma(-1), 00441 histogramNormType(HOGDescriptor::L2Hys), L2HysThreshold(0.2), gammaCorrection(true), 00442 nlevels(HOGDescriptor::DEFAULT_NLEVELS) 00443 {} 00444 00445 CV_WRAP HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, 00446 Size _cellSize, int _nbins, int _derivAperture=1, double _winSigma=-1, 00447 int _histogramNormType=HOGDescriptor::L2Hys, 00448 double _L2HysThreshold=0.2, bool _gammaCorrection=false, 00449 int _nlevels=HOGDescriptor::DEFAULT_NLEVELS) 00450 : winSize(_winSize), blockSize(_blockSize), blockStride(_blockStride), cellSize(_cellSize), 00451 nbins(_nbins), derivAperture(_derivAperture), winSigma(_winSigma), 00452 histogramNormType(_histogramNormType), L2HysThreshold(_L2HysThreshold), 00453 gammaCorrection(_gammaCorrection), nlevels(_nlevels) 00454 {} 00455 00456 CV_WRAP HOGDescriptor(const String& filename) 00457 { 00458 load(filename); 00459 } 00460 00461 HOGDescriptor(const HOGDescriptor& d) 00462 { 00463 d.copyTo(*this); 00464 } 00465 00466 virtual ~HOGDescriptor() {} 00467 00468 CV_WRAP size_t getDescriptorSize() const; 00469 CV_WRAP bool checkDetectorSize() const; 00470 CV_WRAP double getWinSigma() const; 00471 00472 CV_WRAP virtual void setSVMDetector(const vector<float>& _svmdetector); 00473 00474 virtual bool read(FileNode& fn); 00475 virtual void write(FileStorage& fs, const String& objname) const; 00476 00477 CV_WRAP virtual bool load(const String& filename, const String& objname=String()); 00478 CV_WRAP virtual void save(const String& filename, const String& objname=String()) const; 00479 virtual void copyTo(HOGDescriptor& c) const; 00480 00481 CV_WRAP virtual void compute(const Mat& img, 00482 CV_OUT vector<float>& descriptors, 00483 Size winStride=Size(), Size padding=Size(), 00484 const vector<Point>& locations=vector<Point>()) const; 00485 //with found weights output 00486 CV_WRAP virtual void detect(const Mat& img, CV_OUT vector<Point>& foundLocations, 00487 vector<double>& weights, 00488 double hitThreshold=0, Size winStride=Size(), 00489 Size padding=Size(), 00490 const vector<Point>& searchLocations=vector<Point>()) const; 00491 //without found weights output 00492 CV_WRAP virtual void detect(const Mat& img, CV_OUT vector<Point>& foundLocations, 00493 double hitThreshold=0, Size winStride=Size(), 00494 Size padding=Size(), 00495 const vector<Point>& searchLocations=vector<Point>()) const; 00496 //with result weights output 00497 CV_WRAP virtual void detectMultiScale(const Mat& img, CV_OUT vector<Rect>& foundLocations, 00498 vector<double>& foundWeights, double hitThreshold=0, 00499 Size winStride=Size(), Size padding=Size(), double scale=1.05, 00500 double finalThreshold=2.0,bool useMeanshiftGrouping = false) const; 00501 //without found weights output 00502 CV_WRAP virtual void detectMultiScale(const Mat& img, CV_OUT vector<Rect>& foundLocations, 00503 double hitThreshold=0, Size winStride=Size(), 00504 Size padding=Size(), double scale=1.05, 00505 double finalThreshold=2.0, bool useMeanshiftGrouping = false) const; 00506 00507 CV_WRAP virtual void computeGradient(const Mat& img, CV_OUT Mat& grad, CV_OUT Mat& angleOfs, 00508 Size paddingTL=Size(), Size paddingBR=Size()) const; 00509 00510 static vector<float> getDefaultPeopleDetector(); 00511 static vector<float> getDaimlerPeopleDetector(); 00512 00513 CV_PROP Size winSize; 00514 CV_PROP Size blockSize; 00515 CV_PROP Size blockStride; 00516 CV_PROP Size cellSize; 00517 CV_PROP int nbins; 00518 CV_PROP int derivAperture; 00519 CV_PROP double winSigma; 00520 CV_PROP int histogramNormType; 00521 CV_PROP double L2HysThreshold; 00522 CV_PROP bool gammaCorrection; 00523 CV_PROP vector<float> svmDetector; 00524 CV_PROP int nlevels; 00525 }; 00526 00527 /****************************************************************************************\ 00528 * Planar Object Detection * 00529 \****************************************************************************************/ 00530 00531 class CV_EXPORTS PlanarObjectDetector 00532 { 00533 public: 00534 PlanarObjectDetector(); 00535 PlanarObjectDetector(const FileNode& node); 00536 PlanarObjectDetector(const vector<Mat>& pyr, int _npoints=300, 00537 int _patchSize=FernClassifier::PATCH_SIZE, 00538 int _nstructs=FernClassifier::DEFAULT_STRUCTS, 00539 int _structSize=FernClassifier::DEFAULT_STRUCT_SIZE, 00540 int _nviews=FernClassifier::DEFAULT_VIEWS, 00541 const LDetector& detector=LDetector(), 00542 const PatchGenerator& patchGenerator=PatchGenerator()); 00543 virtual ~PlanarObjectDetector(); 00544 virtual void train(const vector<Mat>& pyr, int _npoints=300, 00545 int _patchSize=FernClassifier::PATCH_SIZE, 00546 int _nstructs=FernClassifier::DEFAULT_STRUCTS, 00547 int _structSize=FernClassifier::DEFAULT_STRUCT_SIZE, 00548 int _nviews=FernClassifier::DEFAULT_VIEWS, 00549 const LDetector& detector=LDetector(), 00550 const PatchGenerator& patchGenerator=PatchGenerator()); 00551 virtual void train(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints, 00552 int _patchSize=FernClassifier::PATCH_SIZE, 00553 int _nstructs=FernClassifier::DEFAULT_STRUCTS, 00554 int _structSize=FernClassifier::DEFAULT_STRUCT_SIZE, 00555 int _nviews=FernClassifier::DEFAULT_VIEWS, 00556 const LDetector& detector=LDetector(), 00557 const PatchGenerator& patchGenerator=PatchGenerator()); 00558 Rect getModelROI() const; 00559 vector<KeyPoint> getModelPoints() const; 00560 const LDetector& getDetector() const; 00561 const FernClassifier& getClassifier() const; 00562 void setVerbose(bool verbose); 00563 00564 void read(const FileNode& node); 00565 void write(FileStorage& fs, const String& name=String()) const; 00566 bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT vector<Point2f>& corners) const; 00567 bool operator()(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints, 00568 CV_OUT Mat& H, CV_OUT vector<Point2f>& corners, 00569 CV_OUT vector<int>* pairs=0) const; 00570 00571 protected: 00572 bool verbose; 00573 Rect modelROI; 00574 vector<KeyPoint> modelPoints; 00575 LDetector ldetector; 00576 FernClassifier fernClassifier; 00577 }; 00578 00579 struct CV_EXPORTS DataMatrixCode { 00580 char msg[4]; //TODO std::string 00581 Mat original; 00582 Point corners[4]; //TODO vector 00583 }; 00584 00585 CV_EXPORTS void findDataMatrix(const Mat& image, std::vector<DataMatrixCode>& codes); 00586 CV_EXPORTS void drawDataMatrixCodes(const std::vector<DataMatrixCode>& codes, Mat& drawImage); 00587 } 00588 00589 /****************************************************************************************\ 00590 * Datamatrix * 00591 \****************************************************************************************/ 00592 00593 struct CV_EXPORTS CvDataMatrixCode { 00594 char msg[4]; 00595 CvMat *original; 00596 CvMat *corners; 00597 }; 00598 00599 #include <deque> 00600 CV_EXPORTS std::deque<CvDataMatrixCode> cvFindDataMatrix(CvMat *im); 00601 #endif 00602 00603 #endif