問(wèn)題:subplot和imshow結(jié)合使用時(shí)無(wú)法將圖像顯示在圖形窗口中。該如何解決?

老師,如果方便的話(huà)可以發(fā)一下源代碼嗎?想復(fù)現(xiàn)問(wèn)題看看原因。老師可以先去matlab這個(gè)軟件試試看,如果matlab這邊顯示ok,應(yīng)該是還在開(kāi)發(fā)中。
MATLAB代碼:
clear all
src=im2double(imread("gray.jpg"));
subplot(1,3,1);imshow(src);
mask=imread("mask_inkpainting.bmp");
subplot(1,3,2);imshow(mask);
if ismatrix(src)
result=src.*mask;
else
src_R=src(:,:,1);src_G=src(:,:,2);src_B=src(:,:,3);
result_R=src_R.*mask;
result_G=src_G.*mask;
result_B=src_B.*mask;
result=cat(3,result_R,result_G,result_B);
end
subplot(1,3,3);imshow(result);
在MATLAB中運(yùn)行沒(méi)問(wèn)題,請(qǐng)問(wèn)圖像處理工具箱還在開(kāi)發(fā)階段嗎?
在北太天元中, imshow 函數(shù)默認(rèn)單獨(dú)開(kāi)窗口顯示圖片, 沒(méi)有辦法指定父窗口.
可以使用 image 函數(shù)實(shí)現(xiàn)上述功能, 同時(shí)使用 axis("off") 關(guān)掉坐標(biāo)軸顯示, 可以達(dá)到 imshow 相同的效果.
img1 = im2double(imread("figure1.png"));
img2 = im2double(imread("figure2.png"));
subplot(1, 2, 1);
image(img1);
axis("off");
subplot(1, 2, 2);
image(img2);
axis("off");實(shí)現(xiàn)的效果如下:

