Position of the square in the 3D camera coordinate system

asked 2016-07-01 03:29:40 -0600

Nek gravatar image

Hello. My problem is probably trivial, but I can not find the solution. I have a calibrated camera (camera matrix and distortion coeffs) and a square (size is known). I need to find the position of the square in the 3D camera coordinate system.

edit retag flag offensive close merge delete

Comments

You should look at cv::solvePnP function.

You could use the four corners of the square as the object points and you will need to find a method to detect these corners in the image.

Eduardo gravatar imageEduardo ( 2016-07-01 06:35:25 -0600 )edit

Thanks for prompt reply. But this function needs the array of object points in the object coordinate space (corresponding points). How can I compute this, if I have just pixel coordinates of points?

Nek gravatar imageNek ( 2016-07-01 06:53:23 -0600 )edit

You said you know the size of the square. Say that all the corners are at z=0, and one of the corners is (0,0,0). Then you know where the others are.

Tetragramm gravatar imageTetragramm ( 2016-07-02 14:06:14 -0600 )edit

Thanks for the explanation. That worked with solvePnP.

Nek gravatar imageNek ( 2016-07-02 16:23:03 -0600 )edit