Ask Your Question
1

File format required in the example build3dmodel.cpp

asked 2013-07-24 04:26:56 -0500

pernixxx gravatar image

Hi all, I would like to give a try to the build3dmodel.cpp demo example included in OpenCV for reconstructing a 3D model given some images of an object taken with a calibrated camera. The line command requires the following parameters:

build3dmodel -i intrinsics_filename.yml [-d detector] [-de descriptor_extractor] -m model_name.yml

Do anyone have ever tried it? Do you have or can provide an example of the input file (intrinsics_filename.yml) containing the calibration data?

Regards Federico

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-07-24 04:47:05 -0500

berak gravatar image

updated 2013-07-24 05:09:56 -0500

you'll have to calibrate both of your cameras before.

this will give you an intrinsics.yml, containing a camera matrix(M) and a mat of distortion coeffs(D) per cam.

( you could use stereo_calibration for this, it would give you the desired file with both cams at a time, but it's definitely more pain to do. so just do 2 single calibrations and concat the output to a single file similar to this one ):


%YAML:1.0
M1: !!opencv-matrix
   rows: 3
   cols: 3
   dt: d
   data: [ 9.5743840072544333e+002, 0., 3.9758112215955236e+002, 0.,
       9.5743840072544333e+002, 2.4543538137869606e+002, 0., 0., 1. ]
D1: !!opencv-matrix
   rows: 1
   cols: 8
   dt: d
   data: [ -1.9585193838073178e-001, -3.6240697544102501e-001, 0., 0.,
       0., 0., 0., -1.3099251281533999e+000 ]
M2: !!opencv-matrix
   rows: 3
   cols: 3
   dt: d
   data: [ 9.5743840072544333e+002, 0., 3.2842822528436216e+002, 0.,
       9.5743840072544333e+002, 1.4142796122371439e+002, 0., 0., 1. ]
D2: !!opencv-matrix
   rows: 1
   cols: 8
   dt: d
   data: [ -1.6914752581778550e-001, -9.5256780141422942e-002, 0., 0.,
       0., 0., 0., 1.2054120883082130e-001 ]
edit flag offensive delete link more

Comments

Thanks for your answer. My task is that of reconstructing an object from a bunch of already calibrated cameras, stereo_calibration.cpp seems not having any reconstruction capability, it just performs image rectification in order to align the scanlines of the two images.

The "tricky" undocumented part of build3dmodel.cpp is the readModelViews function which reads further data in addition to the calibration data from the .yml input file:

static bool readModelViews( const string& filename, vector<Point3f>& box, vector<string>& imagelist, vector<Rect>& roiList, vector<Vec6f>& poseList )

pernixxx gravatar imagepernixxx ( 2013-07-24 05:59:40 -0500 )edit

"The "tricky" undocumented part of build3dmodel.cpp is the readModelViews function"

yes, very true. unfortunately, no idea about that

berak gravatar imageberak ( 2013-07-24 09:35:46 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-07-24 04:26:56 -0500

Seen: 649 times

Last updated: Jul 24 '13