简体   繁体   English

如何使用Matlab APP DESIGNER在用户界面中同时显示两个单独的图像?

[英]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. 您无需使用功能axesimread使用App Designer进行imread For example, you create two components named app.Image and app.Image_2 . 例如,创建两个名为app.Imageapp.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.

相关问题 如何使用Matlab App Designer显示数据/信息? - How do I display data/information with Matlab App Designer? MATLAB:如何同时显示两个图像 - MATLAB: How to display two images at the same time 如何在Matlab中显示RGB图像,其中每个通道都是单独的矩阵? - How to display RGB images in Matlab, where each channel is separate matrix? 有没有办法在 MATLAB App Designer UIAxes 中显示箱线图? - Is there way to display in MATLAB App Designer UIAxes a boxplot? 如何使用 Matlab 的 App Designer 将文本包装在标签中 - How to wrap text in a label using Matlab's App Designer MATLAB应用程序设计器:在两个应用程序之间共享数据(在启动功能中,不使用按钮提取第二个应用程序中的数据) - MATLAB app designer: Share data between two apps (in startup function not using button to extract data in second app) 如何在 Matlab 的应用程序设计器应用程序中显示具有另一个表作为变量的表? - How do I display a table which has another table as a variable in app designer app in Matlab? 使用Matlab App Designer获取鼠标点 - Getting Mouse Points using Matlab App Designer 使用代码退出应用程序设计器 GUI - Matlab - Quit an App designer GUI using a code - Matlab 如何在Matlab上同时运行两个程序? - How to run two programs simultaneously on Matlab?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM