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

30 ビュー (過去 30 日間)
Hi,
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.

回答 (1 件)

Simon Allosserie
Simon Allosserie 2021 年 3 月 2 日
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.

カテゴリ

Help Center および File ExchangeCamera Calibration についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by