00001 // This is core/vpgl/algo/vpgl_triangulate_points.h 00002 #ifndef VPGL_TRIANGULATE_POINTS_H 00003 #define VPGL_TRIANGULATE_POINTS_H 00004 //: 00005 // \file 00006 // \brief Determines the 3D location of a point in world space given the 2D location of the point as seen by a collection of cameras. 00007 // \author Andrew Hoelscher 00008 // \date August 28, 2011 00009 00010 #include <vcl_vector.h> 00011 00012 #include <vgl/vgl_point_2d.h> 00013 #include <vgl/vgl_point_3d.h> 00014 00015 #include <vpgl/vpgl_perspective_camera.h> 00016 00017 00018 class vpgl_triangulate_points 00019 { 00020 public: 00021 //: Calculates the best 3D point corresponding to a set of 2D camera points. 00022 // Takes in a list of points and cameras, and finds the 00023 // least-squared solution to the intersection of the rays 00024 // generated by the points. Assumes that point i is viewed 00025 // by camera i. The result is placed into point_3d. Returns 00026 // the sum of squared errors. 00027 static double triangulate( 00028 const vcl_vector<vgl_point_2d<double> > &points, 00029 const vcl_vector<vpgl_perspective_camera<double> > &cameras, 00030 vgl_point_3d<double> &point_3d); 00031 }; 00032 00033 #endif // VPGL_TRIANGULATE_POINTS_H