Research Group on Visual Computation

A Direct Least-Squares Solution to Multi-View Absolute and Relative Pose from 2D-3D Perspective Line Pairs

Icon of project Related projects: Multi-view Pose Estimation from Line Correspondences

Description

This page contains the code for the absolute and relative pose estimation for a Multiview camera system using 3D-2D line correspondences that use perspective cameras including also outliers filtering step. The solution is useful for many computer vision applications such as visual Odometry, simultaneous localization and mapping (SLAM), image-based localization and navigation, augmented reality.

Experimental results confirm the stable and real-time performance under realistic noise on the line parameters. Comparative tests show that our method compares favorably to the latest state of the art algorithms

Our solution works for multi-view scenarios and it is robust up to 60% outlier ratio when combined with a RANSAC-like method.

Files

All the codes are released under the GNU General Public License and contain the methods described in our [1] publication, you can download the full test environment here: code

    MRPnL LM (full pipeline) and MRPnL (only the direct least-squares solver)
  • To run MRPnL LM (full pipeline) call: [poses] = MRPnL_LM(input,camNum,lineNum,type);

  • To run MRPnL (only the direct least-squares solver without the refinement step) call: [poses] = MRPnL(input,camNum,lineNum,type);

  • To run MRPnL (only the direct least-squares solver without the refinement step) with one camera and get back all the valide solutions sorted based on the line backprojection error call: [poses] = MRPnL_all_solutions(input,lineNum,type);

    Example input: input, it contains data for 5 cameras and 60 2D-3D line correspondances

    MRPnL RANSAC demo
  • To run MRPnL in a RANSAC way call: [poses] = MRPnL_RANSAC(input,lineNum,type,threshold);

  • Example input: input for the RANSAC demo, the data contains 5 cameras and 120 lines (60 lines/120 are outliers). 'threshold' is the line backprojection value that separates the inliers from the outliers

Input parameters:

  1. input.Camera(:).Line.start = normalized coordinates of the image line segment startpoints (nx3)
  2. input.Camera(:).Line.end = normalized coordinates of the image line segment endpoints (nx3)
  3. input.line3D.start = start points of the 3D line segments in the world coordinate system (nx3)
  4. input.line3D.end = end points of the 3D line segments in the world coordinate system (nx3)
  5. type = referring to the solver generator used in [1] to generate the solver, it can be 1 or 2
    1 : calling the solver generated with the Matlab automatic generator of Kukelova et al.
    2 : calling the solver generated with the c++ solver generator of Kneip ( we used mex to be able to run it from Matlab)
    Please check reference 13 and 11 in [1]
  6. camNum= number of camera.
  7. lineNum= number of 2D-3D line pairs to be used
  8. threshold= only for RANSAC:is the backprojection threshold that separate the inliers from the outliers

NOTE: we assume a calibrated perspective camera, and we work with the equivalent normalized image coordinates of the line endpoints. If we have a matrix M of size 3xn which contains the 2D coordinates with homogeneous coordinate representation in the image plane then we can normalize the coordinates as follows:
temp = inv(K) * M;
for i=1:n
M_normalized(:,i) = temp(:,i) / temp(3,i)
end

Output:
poses: a cell which contains a list of poses of 4*4 matrix
poses{1} acts from the world coordinate system to the reference camera ('Absolute pose').
poses{2:camNum} acts from the reference camera to the other cameras ('Relative Poses').
Note that the output poses are already denormalized to the original world coordinate system

Please cite our [1] publication whenever you use the implementation.

Publications to cite:
  1. Hichem Abdellali, Robert Frohlich, Zoltan Kato, A Direct Least-Squares Solution to Multi-View Absolute and Relative Pose from 2D-3D Perspective Line Pairs, In Proceedings of ICCV Workshop on 3D Reconstruction in the Wild, Seoul, Korea, 2019. [bibtex]

Hichem Abdellali has been awarded the Doctor of Philosophy (PhD.) degree...

2022-04-30


Hichem Abdellali has been awarded the KÉPAF Kuba Attila prize...

2021-06-24