Out a scale on the image?

1 vue (au cours des 30 derniers jours)
Irfan Tahir
Irfan Tahir le 4 Juil 2017
Commenté : Irfan Tahir le 4 Juil 2017
Hi, I need to put the scale the length scale im mm along the image? how can i do that. My image is 0.101 mm/pixel
% code
a=imread('C00001.tif');
imshow(a);
How can i do that? An example is the one attached

Réponse acceptée

Image Analyst
Image Analyst le 4 Juil 2017
Try using line() and text() to put them into the overlay:
grayImage = imread('cameraman.tif');
imshow(grayImage);
% Get the dimensions of the image.
% numberOfColorChannels should be = 1 for a gray scale image, and 3 for an RGB color image.
[rows, columns, numberOfColorChannels] = size(grayImage);
mmPerPixel = 0.101;
% Find out how many pixels 10 mm is
pixelsPerCm = 10 / mmPerPixel;
% Draw a line
x1 = 10; % Starting column.
x2 = x1 + pixelsPerCm;
y = round(0.9 * rows);
line([x1, x2], [y, y], 'Color', 'r', 'LineWidth', 3);
text(x1, y-20, '1 cm', 'Color', 'r', 'FontSize', 20);
  1 commentaire
Irfan Tahir
Irfan Tahir le 4 Juil 2017
thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Modify Image Colors dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by