00001 /* This file is part of Polyora, a multi-target tracking library. 00002 Copyright (C) 2010 Julien Pilet 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License along 00015 with this program. If not, see <http://www.gnu.org/licenses/>. 00016 00017 To contact the author of this program, please send an e-mail to: 00018 julien.pilet(at)calodox.org 00019 */ 00020 #ifndef MSERDETECTOR_H 00021 #define MSERDETECTOR_H 00022 00023 #include <cv.h> 00024 00025 struct MSERegion 00026 { 00027 cv::Point_<float> c,e1,e2; 00028 }; 00029 00030 class MSERDetector 00031 { 00032 00033 public: 00034 MSERDetector(); 00035 unsigned mser(cv::Mat &mat, cv::Mat mask); 00036 00037 CvMSERParams params; 00038 cv::MemStorage storage; 00039 cv::Seq<CvSeq*> contours; 00040 00041 typedef cv::Seq<cv::Point> Contour; 00042 typedef cv::SeqIterator<CvSeq*> iterator; 00043 00044 iterator begin() { return contours.begin(); } 00045 unsigned size() { return contours.size(); } 00046 00047 void getRegion(Contour &c, MSERegion &r); 00048 MSERegion getRegion(Contour &c) { 00049 MSERegion r; 00050 getRegion(c,r); 00051 return r; 00052 } 00053 00054 private: 00055 cv::PCA pca; 00056 cv::Mat_<float> mean; 00057 }; 00058 #endif