Ask Your Question

3D reconstruction

asked 2017-10-16 08:25:35 -0500

There is a tutorial named Camera calibration with square chessboard in section Camera calibration and 3D reconstruction (calib3d module) which indeed explains how to use a calibrated camera for 3D reconstruction. Is there a ready sample corresponding to this tutorial. Where can I find it?

edit retag flag offensive close merge delete


can you point us to the tutorial you mean ?

berak gravatar imageberak ( 2017-10-16 08:28:07 -0500 )edit

this is actually about pose reconstruction using solvePnP, not about reconstructing a 3d model.

(and sadly, no sample code, apart from the (sloppy) tutorial)

berak gravatar imageberak ( 2017-10-16 10:00:16 -0500 )edit

for 3d reconstruction, you'd either need

  • a calibrated stereo rig,
  • depth images, or
  • multiple images(structure from motion)

main problem now is: what are you trying to achieve, exactly ?

berak gravatar imageberak ( 2017-10-16 10:08:28 -0500 )edit

What do you mean by pose reconstruction? Determining the space orientation of the known object? In this case, the full-scale reconstruction may be broken into 2 sub-tasks: object recognition and its pose reconstruction. I would prefer using a single camera which can move around an object and take pictures from different positions. For the beginning, the object may be simple. Let it be a cube.

ya_ocv_user gravatar imageya_ocv_user ( 2017-10-16 10:53:36 -0500 )edit

"Determining the space orientation of the known object? " -- yes, exactly, that's another word for it.

berak gravatar imageberak ( 2017-10-16 11:04:43 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-10-18 09:52:39 -0500

I have spotted a good introduction at From this description one can sort out what functions are available and which to use for which tasks. So far as I understand, solvePnP() finds the pose as rotation + translation, but first I must 1. Define my own (arbitrary) coordinate system and present (InputArray) objectPoints in this system. 2. present (InputArray) imagePoints provided by

vector<point2f> corners; //this will be filled by the detected corners

bool patternfound = findChessboardCorners(gray, patternsize, corners,...);

corners are used as imagePoints. They are 2D coordinates in image space. If the shape of the object is known, I can do full 3D reconstruction from just 1 image taken by just 1 calibrated camera. If it is unknown, binocular vision or exact camera location in case of the single camera is needed. Then, one can take at least 2 stereo pictures from opposite sides and calculate 3D coordinates of characteristic points.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-10-16 08:25:35 -0500

Seen: 179 times

Last updated: Oct 18 '17