ConnectedComponents.h
Go to the documentation of this file.
1 /*
2  * This file is part of ALVAR, A Library for Virtual and Augmented Reality.
3  *
4  * Copyright 2007-2012 VTT Technical Research Centre of Finland
5  *
6  * Contact: VTT Augmented Reality Team <alvar.info@vtt.fi>
7  * <http://www.vtt.fi/multimedia/alvar.html>
8  *
9  * ALVAR is free software; you can redistribute it and/or modify it under the
10  * terms of the GNU Lesser General Public License as published by the Free
11  * Software Foundation; either version 2.1 of the License, or (at your option)
12  * any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
17  * for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with ALVAR; if not, see
21  * <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>.
22  */
23 
24 #ifndef CONNECTEDCOMPONENTS_H
25 #define CONNECTEDCOMPONENTS_H
26 
33 #include "Alvar.h"
34 #include "Util.h"
35 #include "Line.h"
36 #include "Camera.h"
37 
38 namespace alvar {
39 
43 enum ALVAR_EXPORT LabelingMethod
44 {
45  CVSEQ
46 };
47 
52 {
53 
54 protected :
55 
58 
59 public :
60 
64  IplImage *gray;
68  IplImage *bw;
69 
73  std::vector<std::vector<PointDouble> > blob_corners;
74 
79  {
81  ADAPT
82  };
83 
85  Labeling();
86 
88  virtual ~Labeling();
89 
93  void SetCamera(Camera* camera) {cam = camera;}
94 
98  virtual void LabelSquares(IplImage* image, bool visualize=false) = 0;
99 
100  bool CheckBorder(CvSeq* contour, int width, int height);
101 
102  void SetThreshParams(int param1, int param2)
103  {
104  thresh_param1 = param1;
105  thresh_param2 = param2;
106  }
107 };
108 
113 {
114 
115 protected :
116 
117  int _n_blobs;
121 
122  CvMemStorage* storage;
123 
124 public:
125 
126  LabelingCvSeq();
127  ~LabelingCvSeq();
128 
129  void SetOptions(bool _detect_pose_grayscale=false);
130 
131  void LabelSquares(IplImage* image, bool visualize=false);
132 
133  // TODO: Releases memory inside, cannot return CvSeq*
134  CvSeq* LabelImage(IplImage* image, int min_size, bool approx=false);
135 };
136 
137 } // namespace alvar
138 
139 #endif
Main ALVAR namespace.
Definition: Alvar.h:174
This file implements a parametrized line.
void SetThreshParams(int param1, int param2)
This file implements a camera used for projecting points and computing homographies.
ThresholdMethod
Two alternatives for thresholding the gray image. ADAPT (adaptive threshold) is only supported curren...
int visualize
unsigned char * image
Definition: GlutViewer.cpp:155
IplImage * bw
Pointer to binary image that is then labeled.
int thresh_param1
int height
Definition: GlutViewer.cpp:160
Simple Camera class for calculating distortions, orientation or projections with pre-calibrated camer...
Definition: Camera.h:82
Base class for labeling connected components from binary image.
std::vector< std::vector< PointDouble > > blob_corners
Vector of 4-length vectors where the corners of detected blobs are stored.
Camera * camera
int width
Definition: GlutViewer.cpp:159
void SetCamera(Camera *camera)
Sets the camera object that is used to correct lens distortions.
This file implements generic utility functions and a serialization interface.
IplImage * gray
Pointer to grayscale image that is thresholded for labeling.
#define ALVAR_EXPORT
Definition: Alvar.h:168
Labeling class that uses OpenCV routines to find connected components.
This file defines library export definitions, version numbers and build information.


ar_track_alvar
Author(s): Scott Niekum
autogenerated on Mon Jun 10 2019 12:47:04