10 # include <vcl_msvc_warnings.h> 23 for (
const auto & world_pt : world_pts)
47 e2M[0][0] = 0; e2M[0][1] = -e2[2]; e2M[0][2] = e2[1];
48 e2M[1][0] = e2[2]; e2M[1][1] = 0; e2M[1][2] = -e2[0];
49 e2M[2][0] = -e2[1]; e2M[2][1] = e2[0]; e2M[2][2] = 0;
91 H1[0][0] = e1[0]/e1l; H1[0][1] = e1[1]/e1l;
92 H1[1][0] = -e1[1]/e1l; H1[1][1] = e1[0]/e1l;
95 H2[0][0] = e2[0]/e2l; H2[0][1] = e2[1]/e2l;
96 H2[1][0] = -e2[1]/e2l; H2[1][1] = e2[0]/e2l;
98 auto m = static_cast<unsigned int>(img_p1.size());
99 if (
m != img_p2.size()) {
100 std::cerr <<
" In vpgl_affine_rectification::compute_rectification() -- img_p1 and img_p2 do not have equal size!\n";
107 for (
unsigned i = 0; i <
m; i++) {
110 A(i,0) = p2rot[1]; A(i,1) = 1;
117 std::cout <<
"scaling: " << scaling << std::endl;
119 H2[0][0] = scaling[0]*H2[0][0]; H2[0][1] = scaling[0]*H2[0][1];
120 H2[1][0] = scaling[0]*H2[1][0]; H2[1][1] = scaling[0]*H2[1][1];
122 H2[1][2] = scaling[1];
126 for (
unsigned i = 0; i <
m; i++) {
129 AA(i,0) = p2rot[0]; AA(i,1) = p2rot[1]; AA(i,2) = p2rot[2];
135 std::cout <<
"shear: " << shear << std::endl;
138 interm[0][1] = -shear[1] / 2.0;
142 interm[0][0] = shear[0];
143 interm[0][1] = shear[1] / 2.0;
144 interm[0][2] = shear[2];
Methods for computing an affine fundamental matrix, FA using a pair of affine cameras and using FA to...
void add(vgl_point_3d< Type > const &p)
static bool compute_rectification(const vpgl_affine_fundamental_matrix< double > &FA, const std::vector< vnl_vector_fixed< double, 3 > > &img_p1, const std::vector< vnl_vector_fixed< double, 3 > > &img_p2, vnl_matrix_fixed< double, 3, 3 > &H1, vnl_matrix_fixed< double, 3, 3 > &H2)
compute the rectification homographies using the affine fundamental matrix.
Several routines for computing different kinds of cameras from world-point correspondences.
vnl_matrix_fixed & set_identity()
vnl_matrix_fixed< T, num_cols, num_rows > transpose() const
vgl_homg_point_3d< T > camera_center() const override
Find the 3d coordinates of the center of the camera. Will be an ideal point with the sense of the ray...
static bool compute(const std::vector< vgl_point_2d< double > > &image_pts, const std::vector< vgl_point_3d< double > > &world_pts, vpgl_affine_camera< double > &camera)
Compute from two sets of corresponding points.
const vnl_matrix_fixed< T, 3, 4 > & get_matrix() const
Return a copy of the camera matrix.
static bool compute_affine_f(const vpgl_affine_camera< double > *cam1, const vpgl_affine_camera< double > *cam2, vpgl_affine_fundamental_matrix< double > &FA)
extract the fundamental matrix from a pair of affine cameras.
void set_viewing_distance(T dist)
set a finite viewing distance to allow the methods below to return finite objects.
const vnl_matrix_fixed< T, 3, 3 > & get_matrix() const
Get a copy of the FM in vnl form.
static vpgl_affine_camera< double > * compute_affine_cam(const std::vector< vgl_point_2d< double > > &image_pts, const std::vector< vgl_point_3d< double > > &world_pts)
int minimize(vnl_vector< double > &x)
void set_matrix(const vpgl_proj_camera< T > &cr, const vpgl_proj_camera< T > &cl)