Revisiting camera calibration -- can it be done automatically with opencv?
Can get a ballpark camera from a single pass of OpenCV: (1) extract chessboards, (2) calibrate.
pass 2: mask out previous chessboard and re-run pass n: repeat until no new chessboards
Stage 2: find circular path
For each estimated pose,
1. get camera center and add to list
1. get camera rotation and add to list
2. Assume pattern is rotated 180-degrees, find camera center, add to list
3. Repeat 1 and 2 five more times, once for each face of cube.
Find a strong plane in cameras list (ransac)
Find a circle in planar points (ransac)
(there will be four points per camera on this circle, due to cube
ambiguity. use known rotation angle to prune extra points)
For each camera pose, bring to canonical reference frame (pointing toward circle center). Find average deviation (geodesic mean of quaternions).
Estimate missing cameras by interpolation.
Stage 3: Dense point collection
re-run opencv, this time masking each face using roughly known face position
(avoids interference from mutliple faces)
(use white mask to simulate white margin that opencv hope for)
(Hopefully we get points on each face now)
(points now correspond to same faces, so better calibration)
(! possibly rectify top chessboard, to improve capture rate)
(! conservatively mask to remove other faces, then mask everything but good face, leaving a large margin to allow for imperfactions)
Re-run pairwise calibration in opencv
Undistort images
Run bundle adjustment in ceres solver
This calibration occurs without assumptions about cube, which makes it robust to imperfect construction.
POSSIBLE EXTENSIONS
add some ceres solver constraints to ensure reconstruction is cube-like
face points are equally spaced
face points are in orthogonal grid
faces are orthogonal
Posted by
Kyle Simek