Is there any way to get the pixel to distance ratio from the single camera calibrator app?

19 views (last 30 days)
I am trying to find the focal length of the camera setup I am using by running the camera calibrator app. From the apps default settings the focal length is displayed in pixels and I wish to find it in real world units. The focal length is also kept in the "intrinsic matrix" but again the focal length is in pixels. The online documentation says fx=F*sx, (where fx is the focal length in pixels, F is the focal length in real world units, and sx is the conversion factor), but doesnt say where to find/how it is calculated... I was looking through the estimateCameraParameters script that comes with the computer vision toolbox and came across the commands that generate the intrinsic matrix but the computation is a little more complex, something to do with the homography matrix. Anyways is there a way to get the conversion factor?

Answers (1)

Dima Lisin
Dima Lisin on 21 Jul 2015
Unfortunately, by calibrating the camera you can only calculate the focal length in pixels. If you need the focal length in world units, the only thing you can do is look up the pixel size of your camera's sensor in the manufacturer's spec.
I am curious why you need the focal length, though? There are functions in the Computer Vision System Toolbox for doing various measurements using calibrated cameras, that do not require the focal length in world units.
  2 Comments
skelt055
skelt055 on 21 Jul 2015
I am trying to find the length of the side of a box that is not parallel to the direction that the camera is facing. To finish the geometry of what the camera sees as the length of the side of the box I was hoping to use the local length to compute a side of my triangle. Then use all of that combined info to calculate the pixel to distance ratio.
Dima Lisin
Dima Lisin on 22 Jul 2015
Edited: Dima Lisin on 22 Jul 2015
The only way to do that with one camera is if you know the orientation of the plane containing the side of the box relative to the camera. If you can glue a checkerboard to the side of the box, you can do this using the extrinsics function. See this example .

Sign in to comment.

Categories

Find more on MATLAB Support Package for IP Cameras in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!