Ask Your Question

How to calculate the position of the camera from an image

asked 2014-03-20 09:52:54 -0500

stranger123 gravatar image

I have four traingles placed on the corners of an A0 page. Using openCV I have been able to calibrate the camera, through that i have got the distortion and intrinsic files saved. I have been able to detect the triangles using cvblobs or could do it using contours. But what I have to do now is to find the position of the camera so that I could figure out the ideal position to recognize the triangles. I don't know how to do the calculation and to code it. If anyone could please provide the steps in how to carry out and possibly example codes in c++, it would be great.

Thank you in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-03-20 13:34:37 -0500

Look into the function solvePnP which calculates the cameras perspective from given points, so long as you know the model space positions of these points. I assume since they are in the corners of a sheet of paper, you know the real world positions of the triangles?

With 4 points, you could use the P3P flag to solve for 3 points.

The process is very similar to obtaining the camera position relative to an Augmented Reality marker, so looking up tutorials/demo's of that would be a good start.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2014-03-20 09:52:54 -0500

Seen: 2,961 times

Last updated: Mar 20 '14