简体   繁体   English

如何在Matlab GUI中设置轴上的图像?

[英]How to set image in axes in matlab GUI?

i have a code which gives several images as ouput and i want to set all these images in particular axes in GUI in matlab. 我有一个代码,可以输出多个图像,我想在Matlab的GUI中的特定轴上设置所有这些图像。 I'm trying to make a GUI of the code. 我正在尝试制作代码的GUI。 For eg. 例如。

figure,imshow(s1);
figure,imshow(s2);
figure,imshow(s2&s1);

and i want to set the output image of first command in, say axes3, output image of second command in axes4 and similarly last output image in axes5. 我想在例如axis3中设置第一个命令的输出图像,在axis4中设置第二个命令的输出图像,类似地在axis5中设置最后一个输出图像。

Although i know i need to use 虽然我知道我需要使用

set(handles.axes...)

command but i don't know the exact syntax on how to make the image be shown in particular axes. 命令,但我不知道如何使图像显示在特定轴上的确切语法。 Please give explain on how to make this happen with any suitable example. 请通过任何合适的示例说明如何实现此目的。 Thanks in advance. 提前致谢。

First you should create an axes box in your gui, then in tag section get a name ie (original) and finaly in editor when you want to use it code something like this 首先,您应该在gui中创建一个axes框,然后在标签部分中获得名称(即(原始),然后在编辑器中使用final,当您要使用它时,请编写类似以下代码

 A = imread (Path);

 axes(handles.original);

 imshow(A);

I hope to help you... 希望对您有帮助...

One line solution (for each image) is to set the axis as the parent of the image within the imshow command; 一种解决方案(针对每个图像)是在imshow命令中将轴设置为图像的父级。

imshow(image_Data,'Parent',handles.axes1)

There should be no need to open the additional figure windows ( assuming the axes are with the gui...) 无需打开其他图形窗口(假设轴与gui ...一致)

So specifically for the question above: 因此,专门针对上述问题:

imshow(s1,'Parent',handles.axes3);
imshow(s2,'Parent',handles.axes4);
imshow(s2&s1,'Parent',handles.axes5);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM