Code for generalized cameras
Henrik Stewénius
Generalized cameras was where I started to work on
solving minimal problems. Here is some basic code to
handle both fully generalized cameras and
planarly restricted cameras. Needs the c-code provided above to run.
Generalized Camera. Two stations and six points
Files:
solve26.m, The function to call. If run it will
inform on how to compile the c-code to mex.
solve26.c, C-Code to support the above solver. It has to compiled several times with different flags. Run the m-file to get the details.
solve26AFILE.c, Machine generated code
needed to compile the c-code above.
solve26_testvec.mat, data to test
that the program actually works.
solve26lineversion.m, Proof of concept
code for the case with a multicamera with all cameras on a single line in the vehicle coordinate system.
Planarly restricted generalized cameras
For planarly restricted generalized cameras there
are 2 minimal cases.
2 stations and 3 rays
3 stations and 2 rays
Tools used by both
observe_plucker_as_cell.m, takes
a vehicle stations, a set of cameras relative to the vehicle and a set of points and computes observation in vehicle centered plucker coordinates.
observe_plucker.m, as above but as a single matrix.
planar_mov_randconf.mCreate a random
configuration consisting of vehicle stations, cameras relative to
the vehicle and space points.
Code for 2 stations and 3 rays
solve_23grevlex.m, A grevlex based solver in pure matlab. There is no assumption of the generalized camera being a multicamera rig.
solve_23lex_mex.c, A lex order solver written in mex. It assumes that the rig is a multicamera rig, that is, that each point
is seen trough the same point in the vehicle coordinate system at each instant in time.
test_23.m, To test the two above solvers.
Code for 3 stations and 2 rays
(both versions would need to be rewritten if they are to be used in applications.)
solve_32.m,A very naive solver. Relies
on MAPLE for some of the symbolic calculations. I am looking trough my
directories for a better version than this. There are both symbolic blocks
and horrible machine generated blocks.
Test code is given in the help part of the file.
solve_32grevlex.m, A GrevLex based solver. It is still in a state where it uses symbolic operations. It also needs to read the two matrices
solve_32grevlex_K.mat and
solve_32grevlex_multmats.mat.
Test code is given in the help part of the file.
1D generalized camera. Two stations and 6 rays
solve36.m, A very non-optimal Grö based solver. Depends on the matfile below.
solve36_generate_data.m, Generate test input.
solve36_multmats.mat, at set of matrices which are used for polynomial multiplication. I need to ship it this way in order to ship one of my really old and dirty pieces of code.
Further reading
If any parts of the code presented here is used I ask you to reference
at least one of the below publications.
|
|
H. Stewénius.
Gröbner Basis Methods for Minimal Problems in Computer
Vision.
PhD thesis, Lund University, April 2005.
[ bib |
code |
.pdf ]
|
| |
|
|
H. Stewénius, D. Nistér, M. Oskarsson, and K. Åström.
Solutions to minimal generalized relative pose problems.
In Workshop on Omnidirectional Vision, Beijing China, October
2005.
[ bib |
code |
.pdf ]
|
| |
|
|
H. Stewénius and K. Åström.
Structure and motion problems for multiple rigidly moving cameras.
In European Conference on Computer Vision (ECCV), page 238ff,
Prague , Czech Republic, May 2004.
An improved version of this in Chapter 9 of my thesis.
[ bib |
code ]
|
Support and Bug-reports
The code is provided as is and no support is given. Bug reports are welcome
and it is possible that such bugs will get corrected.
|
Two generalized cameras each see 6 points.
Quality comparison for 2 stations and 3 rays
for a solver based on a lex order GB and a
GrevLex order GB. As seen, for most practical
applications there is no reason to prefer one
method over the other.
|