Ask Your Question

How to calculate the distance from the camera origin to any of the corners? (square chessboard calibration)

asked 2012-10-05 08:22:26 -0600

Silex gravatar image


I am kind of new to OpenCV and I was trying out the tutorials in the OpenCV tutorial sections - by the way really good tutorials, thx for the authors.

The reason I started to trying out the tutorials, so I can get a little familiar with OpenCV. I have a project going on with a humanoid robot where I want to use OpenCV and try out some cool things.

I already calibrated the robots camera thx to the OpenCV tutorials. I read both the calibration tutorials to get as much info about it as I can. At the end of this one there is a question (the same question what my topic has).

Is there an answer to it somewhere, or is there somebody who could answer it?

I would really appreciate it, because than I could use the chessboard for calibrating, image detecting, and for distance measurements!

I realize I can't do everything with a help of a chessboard, but for starter, and as a beginner it would help me a lot!

Parameters I have:

  • The robots camera resolution
  • The size of the chessboard (including the distance between the squares)
  • The robots height
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-10-13 18:33:16 -0600

mgb gravatar image

See SolvePnP

Supply the image coordinates or each square's corners (or just the corners of the board) along with their real-world positions on the board - just like you did for the camera calibration.

The rvec and tvec returned will contain the rotation of the camera relative to the chessboard and the position (translation) of the chessboard in camera coords.

A single flat symmetric chessboard target isn't really the best choice for this if you care about the angle.

edit flag offensive delete link more


Thank you for your answer! If not a chessboard what would you use? I would like to care about the angle because the robot can stand anywhere in the room.

Silex gravatar imageSilex ( 2012-10-15 03:32:08 -0600 )edit

Question Tools

1 follower


Asked: 2012-10-05 08:22:26 -0600

Seen: 6,923 times

Last updated: Oct 13 '12