Image alignment after using 'axis image'

97 ビュー (過去 30 日間)
SG
SG 2015 年 7 月 28 日
回答済み: Usha Duddu 2015 年 7 月 31 日
I'm displaying an image and then using 'axis image' to keep the right proportions. This re-sizing process places the resulting image in the middle of the subplot, but I'd like to align the image to the left. Is there a way to achieve this?
RGB = imread('C:\Users\...\file.png');
image(RGB);
axis image;

回答 (1 件)

Usha Duddu
Usha Duddu 2015 年 7 月 31 日
Hi SG
I understand that you are trying to align an image over the left hand corner of a subplot. It is not possible to do it while using axis image since this command will fit the axes box tightly around the data. Below is a simplified example code snippet that performs the desired functionality.
>>im=imread('peppers.png');
>>subplot(2,2,4);
>>axes('position',[0.57,0.15,0.25,0.25]);
>>imshow(im);
You can use 'position' property of axes object in order to position the image at the desired location within the figure.
Hope this helps!
Usha

カテゴリ

Help Center および File ExchangeGet Started with Image Processing Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by