ConnectedComponents.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of ALVAR, A Library for Virtual and Augmented Reality.
00003  *
00004  * Copyright 2007-2012 VTT Technical Research Centre of Finland
00005  *
00006  * Contact: VTT Augmented Reality Team <alvar.info@vtt.fi>
00007  *          <http://www.vtt.fi/multimedia/alvar.html>
00008  *
00009  * ALVAR is free software; you can redistribute it and/or modify it under the
00010  * terms of the GNU Lesser General Public License as published by the Free
00011  * Software Foundation; either version 2.1 of the License, or (at your option)
00012  * any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful, but WITHOUT
00015  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00016  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00017  * for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public License
00020  * along with ALVAR; if not, see
00021  * <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>.
00022  */
00023 
00024 #ifndef CONNECTEDCOMPONENTS_H
00025 #define CONNECTEDCOMPONENTS_H
00026 
00033 #include "Alvar.h"
00034 #include "Util.h"
00035 #include "Line.h"
00036 #include "Camera.h"
00037 
00038 namespace alvar {
00039 
00043 enum ALVAR_EXPORT LabelingMethod
00044 {
00045         CVSEQ
00046 };
00047 
00051 class ALVAR_EXPORT Labeling
00052 {
00053 
00054 protected :
00055 
00056         Camera   *cam;
00057         int thresh_param1, thresh_param2;
00058 
00059 public :
00060 
00064         IplImage *gray;
00068         IplImage *bw;
00069 
00073         std::vector<std::vector<PointDouble> > blob_corners;
00074 
00078         enum ThresholdMethod 
00079         {
00080                 THRESH,
00081                 ADAPT
00082         };
00083 
00085         Labeling();
00086 
00088         ~Labeling();
00089 
00093         void SetCamera(Camera* camera) {cam = camera;}
00094 
00098         virtual void LabelSquares(IplImage* image, bool visualize=false) = 0;
00099 
00100         bool CheckBorder(CvSeq* contour, int width, int height);
00101 
00102         void SetThreshParams(int param1, int param2)
00103         {
00104                 thresh_param1 = param1;
00105                 thresh_param2 = param2;
00106         }
00107 };
00108 
00112 class ALVAR_EXPORT LabelingCvSeq : public Labeling
00113 {
00114 
00115 protected :
00116 
00117         int _n_blobs;
00118         int _min_edge;
00119         int _min_area;
00120         bool detect_pose_grayscale;
00121 
00122         CvMemStorage* storage;
00123 
00124 public:
00125 
00126         LabelingCvSeq();
00127         ~LabelingCvSeq();
00128 
00129         void SetOptions(bool _detect_pose_grayscale=false);
00130 
00131         void LabelSquares(IplImage* image, bool visualize=false);
00132 
00133         // TODO: Releases memory inside, cannot return CvSeq*
00134         CvSeq* LabelImage(IplImage* image, int min_size, bool approx=false);
00135 };
00136 
00137 } // namespace alvar
00138 
00139 #endif


ar_track_alvar
Author(s): Scott Niekum
autogenerated on Sun Oct 5 2014 22:16:26