Converting coordinates (x,y) and radius (r) from pixels to mm using a calibrated camera intrinsic and extrinsic parameters

9 views (last 30 days)
I've got a series of coordinates (x,y) and radii that are represent the position and radius of circles in an image. The coordinates and radii are both measured in pixels but I'm looking to convert them to mm so I can extract information from it.
I've calibrated the camera that captures these images using the computer vision toolbox, this was so that I could correct for distortion in the image. This generated the intrinsic and extrinsic parameters for the camera.
I've tried to use the funtion 'pointsToWorld' to convert the coordinates from pixels to mm, however the results are wrong and I can't understand why.
I'm wondering if anyone knows of a differnet way to convert from pixels to mm, specifically using the intrinsic and extrinsic parameters.
I'm aware that I could calculate the spatial calibraiton factor a different way, however can this also be calucalted directly from the intrinsic and extrinsic parameters?
Any help would be much appriciated.

Answers (1)

Simon Allosserie
Simon Allosserie on 2 Mar 2021
You can obtain the dpi of your image from the imfinfo structure
dpi = imfinfo(filepath).XResolution %analogous for YResolution
And then using the knowledge that 1 inch = 25.4 mm to calculate the pixel size
pix = 25.4/dpi %pixel size in mm
So if a radius is e.g. 10 pixels, then you know it's dimensions in mm are 10*pix mm.

Community Treasure Hunt

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

Start Hunting!

Translated by