MATLAB: Add scale bar to image

image processing

How to add scale on the horizontal axis on an image (not on a graph). the image length density is 0.101mm/pixel. How can i just show the scale below the image.

Best Answer

Hi Irfan,
A = imread('your_image.whatever');
sizh = size(A,2); % or any other way to find the number of pixels in the horizontal
% direction if you are not using imread.
xmax = sizh*.101;
image([0 xmax],[],A)
With the second, empty argument in image( ) you can do the same thing in the y direction. ,