[英]How to display two separate images simultaneously in a user interface using the Matlab APP DESIGNER?
I have an user interface which is shown below. 我有一个如下所示的用户界面。 There are couple of sections for displaying images in the Image panel. 有两个部分用于在“图像”面板中显示图像。 If I click the OPEN button in the Option Panel, an image is displayed on the left side of the Image Panel which is fine. 如果单击选项面板中的“打开”按钮,则图像会显示在图像面板的左侧,这很好。 However, problem arises when I click the PROCESS button in the Option Panel. 但是,当我单击“选项面板”中的“处理”按钮时,会出现问题。 I want the image to be displayed on the right side of the Image Panel. 我希望图像显示在“图像面板”的右侧。 But the image is being displayed on a separate window which I don't want. 但是图像正在显示在我不想要的单独窗口中。 Any suggestions would be very much appreciated. 任何建议将不胜感激。 Thank you. 谢谢。
https://imgur.com/ohlmRev https://imgur.com/ohlmRev
https://imgur.com/lU2cbAi https://imgur.com/lU2cbAi
https://imgur.com/TYpAHwe https://imgur.com/TYpAHwe
% Button pushed function: ProcessButton
function ProcessButtonPushed(app, event)
img = imread('Intensity1.jpg');
% get red, green, blue channels
redC = img(:,:,1);
greenC = img(:,:,2);
blueC = img(:,:,3);
% mask where red channel is greater than blue channel and green channel greater than blue channel
mask = redC > blueC & greenC > blueC;
% overlay mask into original image
finalimg = bsxfun(@times, img, cast(mask,class(img)));
f = imshow(finalimg);
ax = axes('Parent',f);
plot(ax);
The new image is being displayed on a separate window instead of being displayed on the right side of the Image Panel of the user interface. 新图像将显示在单独的窗口中,而不是显示在用户界面的图像面板的右侧。 Also, I am getting the following error message: 另外,我收到以下错误消息:
Error using axes Axes cannot be a child of Image. 使用轴时出错轴不能是Image的子级。
Error in Patient4/ProcessButtonPushed (line 215) ax = axes('Parent',f); Patient4 / ProcessButtonPushed中的错误(第215行)ax = axes('Parent',f);
You do not need to use the functions axes
nor imread
with App Designer. 您无需使用功能axes
也imread
使用App Designer进行imread
。 For example, you create two components named app.Image
and app.Image_2
. 例如,创建两个名为app.Image
和app.Image_2
组件。
You can set the image using the property ImageSource
. 您可以使用属性ImageSource
设置图像。
app.Image.ImageSource = 'MyPath\MyImageFileName1.png';
app.Image_2.ImageSource = 'MyPath\MyImageFileName2.png'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.