insert image in frame or panel?

Hi I am want to create a panel or frame on the MATLAB fig such that when the user selects an image by clicking on the open button the image should open in the space that is alloted by the pre-designed frame/panel.How do I do this?

답변 (2개)

Walter Roberson
Walter Roberson 2011년 4월 29일

0 개 추천

ph = uipanel(....)
pax = axis('Parent',ph);
Then to put the image up,
image(pax, ImageData)

댓글 수: 1

researcher
researcher 2011년 4월 29일
this produces an axis over the panel which results in two white spaces on the figure. I want that the selected image should be displayed in the panel without showing axis!
I have pasted the code to open an image below!

댓글을 달려면 로그인하십시오.

researcher
researcher 2011년 4월 29일

0 개 추천

ph = uipanel('Title','Main Panel','FontSize',12,...
'BackgroundColor','white',...
'Position',[.25 .2 .67 .67]);
pax=axis('Parent',ph);
Then to put the image up,
image(pax,IMG)
[filename, pathname]=uigetfile( ...
{'*.jpg','JPEG File (*.jpg)'; ...
'*.*','Any Image file (*.*)'}, ...
'Pick an image file');
var=strcat(pathname,filename);
ORI_IMG=imread(var);
IMG=ORI_IMG;
% Showing the origional image
imshow(IMG);
title('original image');
end

댓글 수: 4

Walter Roberson
Walter Roberson 2011년 4월 29일
Add 'Visible','off' to the axis() call.
Walter Roberson
Walter Roberson 2011년 4월 29일
Also, you should explicitly parent the imshow() against the axis you want it to show up in.
researcher
researcher 2011년 4월 30일
What does this line mean...."parent the imshow()"..I am new to Matlab.It would be great if you can please explain it through a code.Thanks!
Walter Roberson
Walter Roberson 2011년 4월 30일
imshow(IMG,'Parent',TheAxisHandleToDrawOn)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

태그

질문:

2011년 4월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by