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;
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.
1 Comment
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/56078-need-help-in-image-processing-stuff#comment_116084
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/56078-need-help-in-image-processing-stuff#comment_116084
Sign in to comment.