[英]How to display two separate images simultaneously in a user interface using the Matlab APP DESIGNER?
我有一個如下所示的用戶界面。 有兩個部分用於在“圖像”面板中顯示圖像。 如果單擊選項面板中的“打開”按鈕,則圖像會顯示在圖像面板的左側,這很好。 但是,當我單擊“選項面板”中的“處理”按鈕時,會出現問題。 我希望圖像顯示在“圖像面板”的右側。 但是圖像正在顯示在我不想要的單獨窗口中。 任何建議將不勝感激。 謝謝。
% 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);
您無需使用功能axes
也imread
使用App Designer進行imread
。 例如,創建兩個名為app.Image
和app.Image_2
組件。
您可以使用屬性ImageSource
設置圖像。
app.Image.ImageSource = 'MyPath\MyImageFileName1.png';
app.Image_2.ImageSource = 'MyPath\MyImageFileName2.png'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.