Out a scale on the image?

3 visualizzazioni (ultimi 30 giorni)
Irfan Tahir
Irfan Tahir il 4 Lug 2017
Commentato: Irfan Tahir il 4 Lug 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

Risposta accettata

Image Analyst
Image Analyst il 4 Lug 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);

Più risposte (0)

Categorie

Scopri di più su Modify Image Colors in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by