Why the image is upside down when I display it in a graph?
18 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have a problem when I display an image in a plot.The image is upside down in the figure window.
Do you know how to fix this problem?
here is my code to display the image in the graph:
% Load the image
img = imread('KAM-Map_12s.bmp');
hold on;
% Plot the image, with x and y coordinnates
image([150 350],[4 4.7],img);
Thanks in advance
0 件のコメント
採用された回答
Mischa Kim
2014 年 1 月 13 日
編集済み: Mischa Kim
2014 年 1 月 13 日
Simply add (only)
set(gca,'YDir','reverse');
In other words, try
img = imread('KAM-Map_12s.bmp');
hold on;
image([150 350],[4 4.7],img);
set(gca,'YDir','reverse');
0 件のコメント
その他の回答 (2 件)
Image Analyst
2014 年 1 月 7 日
The direction of the y axis is reversed from regular graphs since the convention is that the top of the image is line 1 and line numbers increase as you go down. You can set ydir to 'reverse' or call flipud(imageArray).
2 件のコメント
Image Analyst
2014 年 1 月 13 日
Is img color or grayscale? What does this say
[rows, columns, numberOfColorChannels] = size(img) % No semicolon
参考
カテゴリ
Help Center および File Exchange で Convert Image Type についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!