Skip to content

Repository files navigation

Project structure

using CylindersBasedCameraResectioning

Comparisons

Ceres nonlinear least squares (Gauss-Helmert algebraic error)

Minimises ∑ (l' K R d)² over shared intrinsics and per-view rotations using Ceres Levenberg-Marquardt, equivalent to MATLAB's lsqnonlin. Requires brew install ceres-solver nlohmann-json. Build once:

cd ceres_solver && mkdir -p build && cd build && cmake .. && make

Generate a synthetic scene (2 views, 3 cylinders) and run the solver:

# Without noise
julia --project=. scripts/generate_ceres_scene.jl
./ceres_solver/build/calibrate ceres_solver/scene_data.json

# With 1-pixel line noise
julia --project=. scripts/generate_ceres_scene.jl --noise 1.0
./ceres_solver/build/calibrate ceres_solver/scene_data_noisy.json

Geometric-parametric homotopy (Julia)

Runs the same fₓ fᵧ cₓ cᵧ geometric homotopy as Lab.compare_parameter_homotopies on the JSON scene exported above and prints a table identical in format to the Ceres output.

The geometric homotopy solves the algebraic system l'KRd=0 exactly and requires noise-free silhouette lines (the polynomial system has no real solutions for noisy lines). Use the noiseless scene for this comparison:

julia --project=. scripts/generate_ceres_scene.jl
julia --project=. scripts/compare_homotopy.jl ceres_solver/scene_data.json

For the noisy comparison, use the Ceres solver (see above), which minimises a least-squares residual and is robust to noise.

Standard parametric vs Geometric parametric

  • CylindersBasedCameraResectioning.Lab.compare_parameter_homotopies()

Geometric homotopy for different intrinsic configurations

  • Run tests CylindersBasedCameraResectioning.Lab.compare_execution_times()
  • Visualize results CylindersBasedCameraResectioning.Lab.export_scene_config_results()

Synthetic tests

  • Generate and run tests, this are saved in "./tmp/reports" CylindersBasedCameraResectioning.Report.multiple_seeds_multiple_configuration()
  • Merge reports into a single file CylindersBasedCameraResectioning.Report.merge_reports("./tmp/reports/*", "./tmp/reports_merged.jls")
  • View summarized results for the run, the second parameter is the noise configuration if changed. Other named parameters can be set if tests were run under non default configurations (eg: number_of_samples=1) CylindersBasedCameraResectioning.Report.report_error_analysis("./tmp/reports_merged.jls", collect(0.0:0.0005:0.04);)

Synthetic rendered

  • CylindersBasedCameraResectioning.hot_pipes()

Real scene

  • CylindersBasedCameraResectioning.roller_coaster()

CylindersBasedCameraResectioning.jl

This is the file that should be run to the the experiment. No console parameters are required. It is divided into:

  • A synthetic data generation step at the start where cylinder of random transform (or identity for testing) and radiuses are generated
  • Then a fictitious camera is created
  • The relative quadrics, dual quadrics, singular points, planes, points are projected into conics, dual conics, etc
  • A function to find a cylinder silhouette is declared and is used to find the lines defining it for each cylinder. Those are used both for visualization and for solving the problem
  • A visualization step where the 3d scene is show on the left and the projected scene seen throug the camera is shown on the right
  • The solver part:
    • We pick 3 lines (the minimum) from the ones that we found for the silhouettes
    • A parametrization of the rotation matrix using only linear equations in R is defined and solved for using (11)
    • Once the rotation is found the same thing is done for the translation using the original dual quadric

asserts are placed inside a begin - end block so they can be collapsed in the editor when not used

cylinder.jl

Definitions of factory methods for quadrics creation from full parameter definitions, or randomly generatered ones

camera.jl

Factory methods to generate camera matrices

space.jl

Type definitions and factory methods for low level primitives related to 3d objects

plotting.jl

Functions to plot points, lines, cylinders, conics onto the figure of Makie.jl

fromMatrixToFormula.jl

A tool for converting from matrix or vector form to equations in x, y, z to be plotted on external online tools for debugging

debug.jl

Functions used only during debugging like extra plotting or extra steps

utils.jl

Definition of functions for random generation of data and notably of the ≃ "almost equal" sign used in a similar way of the ≈ approximate sign but with a precision that does not the depend of the machine epsilon but is manually choosed depending on the problem at hand

docker-compose.yml

A docker compose for a julia environment that stays up and to which you can connect to to run and test the code

camera.stl / camera.blend

A 3d model of a camera used for visualziation

About

Geometric Aware Camera Pose Estimation. Polimi Thesis. CV1

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages