MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by satendra kumar
on 8 Dec 2012

Hi guys, I have a image of a fractured bone x-ray. I want to measure the length of the fracture. How can i do that? I used "imdistline" but it gave me pixels only. Is there any trick to do that. Please have a look on image here http://prntscr.com/lnpw4

*No products are associated with this question.*

Answer by Image Analyst
on 9 Dec 2012

Multiply that distance in pixels by the spatial calibration factor that you calculated in units of mm per pixel. Use imdistline() on a known length, such as an aluminum plate, then get the factor

mmPerPixel = distanceInMM / distance; % distance comes from imdistline()

Then whenever you measure a distance in pixels again, use that calibration factor:

newDistanceInMm = distanceInPixels * mmPerPixel;

distanceInPixels can come from imdistline(), improfile(), regionprops(), or some other way. I hope that solves your problem. It works for me and is the only way it's done in MATLAB as far as I know, so it should work for you too. I hope you say it does when you reply promptly.

Image Analyst
on 10 Dec 2012

Please see full demo here: http://www.mathworks.com/matlabcentral/answers/56087#answer_67994

## 1 Comment

## Walter Roberson

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/56078#comment_116084

What result were you hoping for, if not pixels?

If you were hoping for a result in physical units such as millimeters, then do you have some kind of physical reference, such as a ruler in the image?