CenekAlbl / RnP

Algorithms for computing the rolling shutter absolute camera pose
BSD 3-Clause "New" or "Revised" License
57 stars 10 forks source link

RnP

Algorithms for computing the rolling shutter absolute camera pose.

Rolling shutter absolute pose

More specifically:

For more details please see below.

The algorithms are available in the following languages:

How it works

The provided solvers compute parameters that describe the absolute pose of a RS camera. In addition to perspective camera parameters the solvers also compute the rotational and translational velocity of the camera.

Projections models

There are two models that are used and returned by the solvers.

Double linearized model

Is described by equation

alpha * [x; (1 + rd * ||x||^2); 1] = K * [(I + (r - r_0) * [w]_x) * (I + [v]_x) * X | C_0 + (r - r_0) * t]

Single linearized model

Is described by equation

alpha * [x; (1 + rd * ||x||^2); 1] = K * [(I + (r - r_0) * [w]_x) * R_0 * X | C_0 + (r - r_0) * t]

Where

Please see [1] for more detailed description.

Usage

Input to the algorithms are either 6 or 7 2D<->3D corredpondences, depending on the algorithm. The output are N solutions for the camera parameters.

Input

C++ example: int num_corresp = 6; Eigen::MatrixXd X = Eigen::MatrixXd::Random(3,num_corresp); Eigen::MatrixXd u = Eigen::MatrixXd::Random(2,num_corresp);

Installation

The library can be compiled with CMake. This will produce the static C++ library, if you want Python or MATLAB bindings see below. The Python bindings are produced thanks to the amazing library Pybind which is included as a submodule.

Follow the classic procedure:

git clone https://github.com/CenekAlbl/RnP.git
cd RnP
git submodule update --init --recursive
mkdir build
cd build
cmake ..
make

Since the compilation with optimizations can take very long, we recommend trying DEBUG version first:

cmake .. -DCMAKE_BUILD_TYPE=DEBUG

After a successful compilation, we recommend to run the tests:

make test

You can also run the benchmark to see the runtime of each algorithm on your machine:

./benchmark

Naturally, you should do it after compilation in the default RELEASE mode, not DEBUG.

Python and Matlab bindings

If you want to compile the Python bindings then:

cmake .. -DPYTHON_BINDINGS=1
make pyrnp

If you want to compile with MATLAB bindings then:

cmake .. -DMATLAB_BINDINGS=1

It tries to find Matlab and Python automatically. If it fails to find yours or you want to specify a different version to be used, try:

-DMatlab_ROOT_DIR=/path/to/your/matlab/folder 

or:

-DPython_EXECUTABLE=/path/to/your/python/binary

Usage

For an example how to use the algorithms take a look in the folder tests or in c++/benchmark.cpp.

R7P

This is the 7 point version for cameras with unknown intrinsics. There are 2 algorithms:

The algorithms were presented in:

[1] Z. Kukelova, C. Albl, A. Sugimoto, K. Schindler, T. Pajdla, "Minimal Rolling Shutter Absolute Pose with Unknown Focal Length and Radial", European Conference on Computer Vision (ECCV) 2020

R6P1lin

This is the single-linearized standalone RS absolute pose solver presented in:

[2] C. Albl, Z. Kukelova, V. Larsson and T. Pajdla, "Rolling Shutter Camera Absolute Pose," in IEEE Transactions on Pattern Analysis and Machine Intelligence, 2019.

R6P2lin

This is the double-linearized RS absolute pose solver that needs an initial camera orientation estimate also presented in:

[3] C. Albl, Z. Kukelova, V. Larsson and T. Pajdla, "Rolling Shutter Camera Absolute Pose," in IEEE Transactions on Pattern Analysis and Machine Intelligence, 2019.

which solves the same equations, but faster than the original:

[4] C. Albl, Z. Kukelova and T. Pajdla, "R6P - Rolling shutter absolute pose problem," 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015.

R6PIter

This is the iterative version of R6P-2lin that needs an initial camera orientation estimate and was presented in:

[5] Kukelova Z., Albl C., Sugimoto A., Pajdla T. Linear Solution to the Minimal Absolute Pose Rolling Shutter Problem. Asian Conference on Computer Vision, 2018.