NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
labelling_method.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 MARKER_TRACKING_LABELLING_METHOD_H_
25 #define MARKER_TRACKING_LABELLING_METHOD_H_
26 
32 #include <camera/camera_params.h>
33 
34 #include <opencv2/core/core_c.h>
35 #include <ar_track_alvar/Alvar.h>
36 #include <ar_track_alvar/Util.h>
37 
38 #include <vector>
39 
40 namespace marker_tracking {
41 
45 class ALVAR_EXPORT Labeling {
46  protected :
50  std::shared_ptr<cv::Mat> bw_;
51 
53  int thresh_param1_, thresh_param2_;
54 
55  public :
56 
60  std::vector<std::vector<alvar::PointDouble> > blob_corners;
61 
62 
64  explicit Labeling(camera::CameraParameters const& cam);
65 
67  virtual ~Labeling();
68 
72  virtual void LabelSquares(std::shared_ptr<cv::Mat> image) = 0;
73 
74  bool CheckBorder(std::vector<cv::Point> contour, int width, int height);
75 
76  void SetThreshParams(int param1, int param2);
77 
78  public:
80 };
81 
85 class ALVAR_EXPORT LabelingCvSeq : public Labeling {
86  protected :
87  int n_blobs_;
88  int min_edge_;
89  int min_area_;
90 
91  public:
92  explicit LabelingCvSeq(camera::CameraParameters const& cam);
93  virtual ~LabelingCvSeq();
94 
95  void LabelSquares(std::shared_ptr<cv::Mat> image);
96 };
97 
98 } // namespace marker_tracking
99 
100 #endif // MARKER_TRACKING_LABELLING_METHOD_H_
marker_tracking::LabelingCvSeq::min_edge_
int min_edge_
Definition: labelling_method.h:88
marker_tracking::Labeling::cam_
camera::CameraParameters cam_
Definition: labelling_method.h:52
marker_tracking::LabelingCvSeq::min_area_
int min_area_
Definition: labelling_method.h:89
camera::CameraParameters
Definition: camera_params.h:58
marker_tracking::Labeling
Base class for labeling connected components from binary image.
Definition: labelling_method.h:45
marker_tracking::LabelingCvSeq::n_blobs_
int n_blobs_
Definition: labelling_method.h:87
marker_tracking::Labeling::EIGEN_MAKE_ALIGNED_OPERATOR_NEW
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Definition: labelling_method.h:79
marker_tracking::Labeling::thresh_param2_
int thresh_param2_
Definition: labelling_method.h:53
marker_tracking
Definition: arconfigio.h:27
marker_tracking::Labeling::blob_corners
std::vector< std::vector< alvar::PointDouble > > blob_corners
Vector of 4-length vectors where the corners of detected blobs are stored.
Definition: labelling_method.h:60
marker_tracking::LabelingCvSeq
Labeling class that uses OpenCV routines to find connected components.
Definition: labelling_method.h:85
camera_params.h
marker_tracking::Labeling::bw_
std::shared_ptr< cv::Mat > bw_
Pointer to binary image that is then labeled.
Definition: labelling_method.h:50