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
댓글 수: 0
채택된 답변
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개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!