core/vpgl/algo/vpgl_invmap_cost_function.h
Go to the documentation of this file.
00001 // This is core/vpgl/algo/vpgl_invmap_cost_function.h
00002 #ifndef vpgl_invmap_cost_function_h_
00003 #define vpgl_invmap_cost_function_h_
00004 //:
00005 // \file
00006 #include <vnl/vnl_cost_function.h>
00007 #include <vnl/vnl_vector_fixed.h>
00008 #include <vpgl/vpgl_camera.h>
00009 
00010 class vpgl_invmap_cost_function: public vnl_cost_function
00011 {
00012   //: Which parameterization to use for the plane
00013   enum plane_param{X_Y=0, X_Z, Y_Z};
00014  public:
00015   //: Constructor - rcam pointer is not deleted by this class
00016   vpgl_invmap_cost_function(vnl_vector_fixed<double, 2> const& image_point,
00017                             vnl_vector_fixed<double, 4> const& plane,
00018                             const vpgl_camera<double>* rcam);
00019   ~vpgl_invmap_cost_function() {}
00020   //: The cost function. x is a vector holding the two plane parameters
00021   double f(vnl_vector<double> const& x);
00022   //: set the parameter values from the 3-d point
00023   void set_params(vnl_vector_fixed<double,3> const& xyz, vnl_vector_fixed<double,2> &x);
00024   //: set the parameter values from the 3-d point
00025   //  (Deprecated interface)
00026   void set_params(vnl_vector_fixed<double,3> const& xyz, vnl_vector<double> &x);
00027   //: get the 3-d point defined by the parameters (and the plane).
00028   void point_3d(vnl_vector_fixed<double,2> const& x, vnl_vector_fixed<double, 3>& xyz);
00029   //: get the 3-d point defined by the parameters (and the plane).
00030   //  (Deprecated interface)
00031   void point_3d(vnl_vector<double> const& x, vnl_vector_fixed<double, 3>& xyz);
00032 
00033  protected:
00034   //: image point
00035   vnl_vector_fixed<double, 2> image_point_;
00036   //: plane coefficients
00037   vnl_vector_fixed<double, 4> plane_;
00038   //: rational camera
00039   const vpgl_camera<double>* cam_ptr_;
00040   //: the well-conditioned parameterization
00041   plane_param pp_;
00042 };
00043 
00044 #endif // vpgl_invmap_cost_function_h_