Serg.Sikoev
Serg.Sikoev

Reputation: 1

Calculating camera coordinates from single img with marker

My goal is calculating camera's world coordinates using flat marker.
I have calibrated the camera and studied all the internal parameters.
The marker is a square.
Look my illustration (unfortunately I can not post it here yet).

{Xc,Yc,Zc} - camera-basis coordinates
{Xw,Yx,Zw} - world coordinates

My task is calculating the camera's coordinates in {Xw,Yw,Zw}-basis.
I need to do this using just one photo.
Actually I need to do it for every photo from my collection.

I have learned projective geometry theory.
I also implemented homography calculation.
Using intrinsic camera matrix which I know after calibration I have solved the system of linear equations and found extrinsic matrix. And it's inverse matrix. The inverse matrix allowed me to find my camera's {Xw,Yw}-coordinates. The solution looks right. I have tryed several photos made from different angles. But I can not calculate Zw.

Now I'm not shure that the problem has a solution. But augmented reality applications solve the similar problem. They calculates the marker vertexes' coordinates in {Xc,Yc,Zc}-basis. If I could do this I would be able to resolve my question too.

I tried to investigate the ARToolKit implementation, but I did not overcome it. I want to understand the substance, not to use any library or ready solution.

Upvotes: 0

Views: 1291

Answers (1)

Raphael Grasset
Raphael Grasset

Reputation: 152

Your problem is a PnP problem with 4 coplanars points where you detect the projected points of the corners of your marker and make the correspondences with the 3d corners of your marker. Generally the corners are defined in the coordinate system of your marker, therefore in the form (X,Y,0).

If you use OpenCV, it's rather simple to implement with solvePnP().

Find an example here (from Mastering OpenCV book):

https://github.com/MasteringOpenCV/code/blob/master/Chapter2_iPhoneAR/Example_MarkerBasedAR/Example_MarkerBasedAR/MarkerDetector.cpp

and the accompanying description here: http://www.packtpub.com/article/marker-based-augmented-reality-on-iPhone-or-iPad

If you want to find the pose from the homography, look at this previously posted article: Computing camera pose with homography matrix based on 4 coplanar points

Upvotes: 1

Related Questions