フィルターのクリア

add scale bar to image

100 ビュー (過去 30 日間)
Irfan Tahir
Irfan Tahir 2017 年 7 月 17 日
コメント済み: David Goodmanson 2019 年 7 月 26 日
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.

採用された回答

David Goodmanson
David Goodmanson 2017 年 7 月 18 日
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. ,
  2 件のコメント
Irfan Tahir
Irfan Tahir 2017 年 7 月 21 日
thanksalot,but using image command, the colormap seems little off.
David Goodmanson
David Goodmanson 2019 年 7 月 26 日
Hi Irfan,
take a look at 'imagesc'.

サインインしてコメントする。

その他の回答 (1 件)

Joshua Brockman
Joshua Brockman 2017 年 9 月 25 日
I often use Matlabs quiver plot with the arrow head turned off to add a vector (which will appear as a bar) to your image.
The way I do this:
figure; imshow(YourImage) hold on
% Pixel Size = size of pixel within your image % Scalebar_length = Desired scale bar length % x_location and y_location are wherever you want your scale bar to appear. quiver(x_location,y_location,Scalebar_length/PixelSize,0,'ShowArrowHead','off')
  1 件のコメント
Rob Campbell
Rob Campbell 2019 年 7 月 25 日
I tried this method and noticed when I labelled the bar by putting text where the center of the bar should be (with 'horizontalalignment' as 'center'), the text was always offset a bit. In figuring that out I found that the bar produced with quiver is a little longer than it ought to be. Better to use plot to do that.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by