簡體   English   中英

如何使用Matlab APP DESIGNER在用戶界面中同時顯示兩個單獨的圖像?

[英]How to display two separate images simultaneously in a user interface using the Matlab APP DESIGNER?

我有一個如下所示的用戶界面。 有兩個部分用於在“圖像”面板中顯示圖像。 如果單擊選項面板中的“打開”按鈕,則圖像會顯示在圖像面板的左側,這很好。 但是,當我單擊“選項面板”中的“處理”按鈕時,會出現問題。 我希望圖像顯示在“圖像面板”的右側。 但是圖像正在顯示在我不想要的單獨窗口中。 任何建議將不勝感激。 謝謝。

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('Parent',f);

您無需使用功能axesimread使用App Designer進行imread 例如,創建兩個名為app.Imageapp.Image_2組件。

您可以使用屬性ImageSource設置圖像。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM