attempt to change the axis of an axes limits remove the original image

1 次查看(过去 30 天)
Hello, I created GUI with several axis and pushing buttons. I loaded binary image to specific axes (let call it axes1). now i would like to change the image axis so it will be tight on the image and than plot on the image afterwards.
now i've been noticed that if i tried to change the image axis the image remove (the axes area turns gray). this is my code:
axes(handles.axes1)
imageAxes1 = imshow(temp_struct.binary_image);
axis([xmin xmax ymin ymax]);
hold on
and from some reason it doesn't work. there are any specific rule for changing axis in GUI? by the way i am using the guide for building the gui.
Thanks.
  1 个评论
dpb
dpb 2014-5-11
编辑:dpb 2014-5-11
I don't have the toolbox so I don't know just what the image object is, precisely, but I wonder if by first creating an axes object then the image object you don't have dueling axes wherein you've changed the limits on the current handle graphics object which is axes1 rather than for the image object axes. The grayout to me implies this that you've made that background axes now the foreground so it's masking the image.
Again, I don't have the Toolbox so can't test, but I'd suggest you dispense with the call to axes and use imshow and it's handle and properties exclusively.
IA has been around this AM, he's the expert; maybe he'll notice this and have the definitive answer altho I suspect it's at least related to the above altho that may not be the optimum solution. (Besides not having the toolbox, I don't do GUIs.)

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2014-5-11
编辑:Image Analyst 2014-5-12
I'd just do this:
axes(handles.axes1)
imshow(temp_struct.binary_image);
axis on; % Or off.
hold on
You can set axis limits with xlim() and ylim() though I don't know why you'd do that, and I'm not sure you can, if you've displayed an image first.
  2 个评论
Image Analyst
Image Analyst 2014-5-12
Not sure either, but it's what I always do. I never do what you did first, though it may be allowed, so I'm not familiar with when that way of calling it should be used. Glad it worked though.

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by