【问题标题】:How to display two separate images simultaneously in a user interface using the Matlab APP DESIGNER?如何使用 Matlab APP DESIGNER 在用户界面中同时显示两个单独的图像?
【发布时间】:2019-08-04 17:06:36
【问题描述】:

我有一个如下所示的用户界面。 “图像”面板中有几个部分用于显示图像。如果我单击选项面板中的打开按钮,图像面板的左侧会显示一个图像,这很好。但是,当我单击选项面板中的 PROCESS 按钮时出现问题。我希望图像显示在图像面板的右侧。但是图像显示在我不想要的单独窗口上。任何建议将不胜感激。谢谢。

https://imgur.com/ohlmRev

https://imgur.com/lU2cbAi

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);

新图像显示在单独的窗口中,而不是显示在用户界面图像面板的右侧。另外,我收到以下错误消息:

使用坐标区时出错 坐标区不能是 Image 的子级。

Patient4/ProcessButtonPushed 中的错误(第 215 行) ax = axes('父',f);

【问题讨论】:

    标签: matlab


    【解决方案1】:

    您无需将函数axesimread 与App Designer 一起使用。 例如,您创建了两个名为 app.Imageapp.Image_2 的组件。

    您可以使用属性ImageSource 设置图像。

    app.Image.ImageSource = 'MyPath\MyImageFileName1.png';
    app.Image_2.ImageSource = 'MyPath\MyImageFileName2.png'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-20
      • 1970-01-01
      • 1970-01-01
      • 2012-05-09
      • 2014-06-01
      • 2012-06-01
      相关资源
      最近更新 更多