如何在Linux上运行的MATLAB中以不可见图形显示 [英] How to imshow with Invisible figure in MATLAB running on Linux
本文介绍了如何在Linux上运行的MATLAB中以不可见图形显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的目标是:
- 创建一个看不见的人
- 使用子图,在其上绘制图像,然后
- 保存它而不打开它.
因此,我正在运行以下代码:
Thus, I am running the following code:
f = figure('Visible', 'off');
subplot(2, 2, 1), imshow(image1);
subplot(2, 2, 2), imshow(image2);
subplot(2, 2, 3), imshow(image3);
subplot(2, 2, 4), imshow(image4);
saveas(f, 'filename');
但是我得到了错误:
Error using imshow (line xxx)
IMSHOW unable to display image.
这意味着imshow正在尝试显示图像.有没有办法让imshow
以不可见的图形显示图像而不尝试弹出?
This means that imshow is trying to display image. Is there a way to have imshow
display image in the invisible figure and not try to pop up?
推荐答案
这可行,
f = figure('Visible', 'off');
subplot(2, 2, 1), image(image1);
subplot(2, 2, 2), image(image2);
subplot(2, 2, 3), image(image3);
subplot(2, 2, 4), image(image4);
saveas(f, 'filename');
In case of gray scale images
f = figure('Visible', 'off');
subplot(2, 2, 1), image(image1),colormap(gray);
subplot(2, 2, 2), image(image2),colormap(gray);
subplot(2, 2, 3), image(image3),colormap(gray);
subplot(2, 2, 4), image(image4),colormap(gray);
saveas(f, 'filename');
imagesc()也可以代替image()函数
imagesc() also can be used instead of image() function
这篇关于如何在Linux上运行的MATLAB中以不可见图形显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文