Position of the square in the 3D camera coordinate system
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.
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.
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?
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.
Thanks for the explanation. That worked with solvePnP.