00001 // This is brl/bmvl/bcal/bcal_zhang_linear_calibrate.h 00002 #ifndef AFX_ZHANGLINEARCALIBRATE_H__A6F24F23_8E39_494F_83FB_3ABF8093481D__INCLUDED_ 00003 #define AFX_ZHANGLINEARCALIBRATE_H__A6F24F23_8E39_494F_83FB_3ABF8093481D__INCLUDED_ 00004 //: 00005 // \file 00006 // \author Kongbin Kang (kk@lems.brown.edu) 00007 // Brown University 00008 // \brief zhang linear camera calibration from planary pattern 00009 // \date 3/23/2003 00010 //------------------------------------------------------------------------------ 00011 00012 #if defined(_MSC_VER) && ( _MSC_VER > 1000 ) 00013 #pragma once 00014 #endif // _MSC_VER > 1000 00015 00016 #include <vnl/vnl_vector_fixed.h> 00017 #include <vnl/vnl_double_3x3.h> 00018 #include <vgl/algo/vgl_h_matrix_2d.h> 00019 #include "bcal_camera_graph.h" 00020 #include "bcal_calibrate_plane.h" 00021 #include "bcal_zhang_camera_node.h" 00022 #include "bcal_euclidean_transformation.h" 00023 00024 class bcal_zhang_linear_calibrate 00025 { 00026 public: 00027 // compute extrinsic parameters of camera 00028 vgl_h_matrix_3d<double> compute_extrinsic(vgl_h_matrix_2d<double> const &H, 00029 vnl_double_3x3 const &A); 00030 00031 // calibrate the camera array 00032 int calibrate(); 00033 00034 // set camera graph 00035 void setCameraGraph(bcal_camera_graph<bcal_calibrate_plane, bcal_zhang_camera_node, bcal_euclidean_transformation>* pG); 00036 bcal_zhang_linear_calibrate(); 00037 virtual ~bcal_zhang_linear_calibrate(); 00038 00039 protected: 00040 int calibrate_extrinsic(); 00041 void calibrate_intrinsic(); 00042 int compute_homography(); 00043 vnl_vector_fixed<double, 6> homg_constrain(vgl_h_matrix_2d<double> const& hm, int i, int j); 00044 // homographies list hm_list[0...n-1] 00045 vnl_double_3x3 compute_intrinsic(vgl_h_matrix_2d<double> *hm_list, int n); 00046 00047 // get closet rotation matrix from a none rotation matrix Q 00048 vnl_double_3x3 get_closest_rotation(vnl_double_3x3 const & Q); 00049 00050 // allocate memory to store homography according to camera graph 00051 int initialize(); 00052 // clear allocated memory. 00053 int clear(); 00054 00055 private: 00056 bcal_camera_graph<bcal_calibrate_plane, bcal_zhang_camera_node, bcal_euclidean_transformation>* cam_graph_ptr_; 00057 vcl_vector<vgl_h_matrix_2d<double> *> h_matrice_; 00058 vcl_vector<int> num_views_; 00059 }; 00060 00061 #endif // AFX_ZHANGLINEARCALIBRATE_H__A6F24F23_8E39_494F_83FB_3ABF8093481D__INCLUDED_
1.4.4