Out a scale on the image?

3 次查看(过去 30 天)
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

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Modify Image Colors 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by