12 vpgl_ba_shared_k_lsqr::
15 const std::vector<std::vector<bool> >& mask)
20 if (
K_.x_scale() != 1.0)
22 K_.set_focal_length(
K_.focal_length() *
K_.x_scale());
23 K_.set_y_scale(
K_.y_scale() *
K_.x_scale());
26 Km_ =
K_.get_matrix();
33 vpgl_ba_shared_k_lsqr::
37 const std::vector<std::vector<bool> >& mask)
42 if (
K_.x_scale() != 1.0)
44 K_.set_focal_length(
K_.focal_length() *
K_.x_scale());
45 K_.set_y_scale(
K_.y_scale() *
K_.x_scale());
48 Km_ =
K_.get_matrix();
53 void vpgl_ba_shared_k_lsqr::jac_Aij(
unsigned int ,
67 jac_camera_center(M,C,bj,Aij_sub);
76 Km_(1,1) = c[0] * K_.y_scale();
77 jac_camera_rotation(Km_,C,r,bj,Aij);
81 void vpgl_ba_shared_k_lsqr::jac_Bij(
unsigned int ,
89 jac_inhomg_3d_point(Pi, bj, Bij);
93 void vpgl_ba_shared_k_lsqr::jac_Cij(
unsigned int ,
103 double inv_f = 1.0/c[0];
104 double skew_term = K_.skew()*inv_f/K_.y_scale();
106 Cij(1,0) = inv_f * (p[1]/p[2] - pp.
y());
107 Cij(0,0) = inv_f * (p[0]/p[2] - pp.
x()) - skew_term*Cij(1,0);
112 vpgl_ba_shared_k_lsqr::param_to_point(
int ,
116 return {bj[0], bj[1], bj[2]};
121 vpgl_ba_shared_k_lsqr::param_to_pt_vector(
int ,
130 vpgl_ba_shared_k_lsqr::param_to_cam(
int ,
134 K_.set_focal_length(c[0]);
142 vpgl_ba_shared_k_lsqr::param_to_cam_matrix(
int ,
147 Km_(1,1) = c[0] * K_.y_scale();
160 vpgl_ba_shared_k_lsqr::
169 for (
unsigned int i=0; i<cameras.size(); ++i)
182 ai[0]=w[0]; ai[1]=w[1]; ai[2]=w[2];
183 ai[3]=C.
x(); ai[4]=C.
y(); ai[5]=C.
z();
185 c[0] /= cameras.
size();
191 vpgl_ba_shared_k_lsqr::create_param_vector(
const std::vector<
vgl_point_3d<double> >& world_points)
194 for (
unsigned int j=0; j<world_points.size(); ++j){
197 bj[0]=point.
x(); bj[1]=point.
y(); bj[2]=point.
z();
double const * data_block() const
vnl_matrix_fixed & update(vnl_matrix< T > const &, unsigned top=0, unsigned left=0)
vnl_vector_fixed< T, 3 > as_rodrigues() const
std::vector< vpgl_calibration_matrix< double > > K_
The fixed internal camera calibration.
const vpgl_calibration_matrix< T > & get_calibration() const
const vgl_rotation_3d< T > & get_rotation() const
std::vector< vnl_double_3x3 > Km_
The fixed internal camera calibration in matrix form.
base class bundle adjustment sparse least squares function.
vnl_matrix< T > extract(unsigned r, unsigned c, unsigned top=0, unsigned left=0) const
const vgl_point_3d< T > & get_camera_center() const
This class implements the perspective camera class as described in Hartley & Zisserman as a finite ca...
vnl_matrix_fixed & set_column(unsigned i, T const *v)
vnl_matrix< double > & update(vnl_matrix< double > const &, unsigned top=0, unsigned left=0)