SfM.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 SFM_H
25 #define SFM_H
26 
33 #include "EC.h"
34 
35 namespace alvar {
36 
42 public:
44  class Feature : public ExternalContainer {
45  public:
48  CvPoint2D32f p2d1;
49  CvPoint3D32f p3d_sh;
50  CvPoint2D32f projected_p2d_sh;
51  int tri_cntr; // This is needed only by UpdateTriangulateOnly
53 
55  has_stored_pose = false;
56  p3d_sh.x = 0.f; p3d_sh.y = 0.f; p3d_sh.z = 0.f;
57  tri_cntr = 0;
58  estimation_type = 0;
59  }
61  has_stored_pose = c.has_stored_pose;
62  pose1 = c.pose1;
63  p2d1 = c.p2d1;
64  p3d_sh = c.p3d_sh;
65  projected_p2d_sh = c.projected_p2d_sh;
66  tri_cntr = c.tri_cntr;
67  estimation_type = c.estimation_type;
68  }
69  };
71  std::map<int, Feature> container;
72  std::map<int, Feature> container_triangulated;
73 
74 protected:
75  std::map<int, Feature> container_reset_point;
76  std::map<int, Feature> container_triangulated_reset_point;
77 
82  bool pose_ok;
83 
84  bool update_tri;
85  std::string multi_marker_file;
87  double scale;
90 
91 public:
93  SimpleSfM() : tf(200, 200, 0.01, 20, 4, 6), pose_ok(false), update_tri(false), markers_found(false) {}
95  void Reset(bool reset_also_triangulated = true);
97  void SetResetPoint();
99  void Clear();
101  void SetScale(double s) { scale = s; }
103  CameraEC *GetCamera();
105  Pose *GetPose();
107  bool AddMultiMarker(const char *fname, FILE_FORMAT format = FILE_FORMAT_XML);
109  bool AddMultiMarker(MultiMarkerEC *mm);
111  void AddMarker(int marker_id, double edge_length, Pose &pose);
113  bool Update(IplImage *image, bool assume_plane=true, bool triangulate=true, float reproj_err_limit=5.f, float triangulate_angle=15.f);
115  bool UpdateTriangulateOnly(IplImage *image);
117  bool UpdateRotationsOnly(IplImage *image);
119  void Draw(IplImage *rgba);
120 };
121 
122 }
123 #endif
Main ALVAR namespace.
Definition: Alvar.h:174
Pose pose_difference
Definition: SfM.h:89
std::map< int, Feature > container_triangulated_reset_point
Definition: SfM.h:76
void SetScale(double s)
Set the suitable scale to be used. This affects quite much how the tracking behaves (when features ar...
Definition: SfM.h:101
f
Simple structure from motion implementation using CameraEC , MarkerDetectorEC and TrackerFeaturesEC...
Definition: SfM.h:41
std::map< int, Feature > container_reset_point
Definition: SfM.h:75
Version of Camera using external container.
Definition: EC.h:392
std::map< int, Feature > container_triangulated
Definition: SfM.h:72
unsigned char * image
Definition: GlutViewer.cpp:155
bool pose_ok
Definition: SfM.h:82
double scale
Definition: SfM.h:87
SimpleSfM()
Constructor.
Definition: SfM.h:93
bool markers_found
Definition: SfM.h:86
Version of MarkerDetector using external container.
Definition: EC.h:656
Version of MultiMarker using external container.
Definition: EC.h:759
CvPoint2D32f projected_p2d_sh
Definition: SfM.h:50
TrackerFeaturesEC tf
Definition: SfM.h:80
void Draw()
FILE_FORMAT
Definition: FileFormat.h:39
Feature(const Feature &c)
Definition: SfM.h:60
Pose representation derived from the Rotation class
Definition: Pose.h:50
CameraEC cam
Definition: SfM.h:78
bool update_tri
Definition: SfM.h:84
XML file format.
Definition: FileFormat.h:66
CvPoint3D32f p3d_sh
Definition: SfM.h:49
#define ALVAR_EXPORT
Definition: Alvar.h:168
Extended version of ExternalContainer structure used internally in SimpleSfM.
Definition: SfM.h:44
std::string multi_marker_file
Definition: SfM.h:85
This file implements a collection of External Container (EC) versions of many ALVAR classes...
MarkerDetectorEC< MarkerData > marker_detector
Definition: SfM.h:79
Pose pose_original
Definition: SfM.h:88
Basic structure to be usable with EC methods.
Definition: EC.h:152
std::map< int, Feature > container
The map of all tracked features.
Definition: SfM.h:71
Pose pose
Definition: SfM.h:81
CvPoint2D32f p2d1
Definition: SfM.h:48
Version of TrackerFeatures using external container.
Definition: EC.h:252


ar_track_alvar
Author(s): Scott Niekum
autogenerated on Thu Jun 6 2019 19:27:24