matlab imwrite plot,Matlab imwrite() quality

I'm very new to Matlab, though I know a few other programming languages, so please forgive me if this is something simple. I have not been able to find any answers to this, either on StackOverflow or elsewhere.

I produce a figure using the following code: figure(6),imageplot(P); drawnow;

Which looks like this:

7068acccb25e50e752145a7841add7e4.png

I then save this image to my computer using the following commands: imwrite(P, 'images/plot.png');

And the resulting image is tiny, and missing some of the color information:

99a156a95c3ae3e30682c1499b75a0bf.png

If, however, I utilize the save function in the open figure (image #1) and save it manually, I get exactly what I want, which is that exact image stored on my computer.

88396bfba04f612dd85e196efec419b4.png

How would I program that? I assumed that imwrite() would just write the image directly, but apparently I'm doing something wrong. Any advice? Perhaps it has something to do with the imageplot command? I cannot seem to get that to work in imwrite.

Update: Based on the comments below, I have begun using "imresize" with the "nearest" option. This scales the image properly, but the resulting image is still curiously darker (and therefore has less information) than if I hit the "save" button in the figure.

Image saved from figure:

4669b0cc397e3affa78ed601653de95d.png

Image using "imresize" with "nearest" option:

c6b6ecbb208785d1ba918e2f90d6f969.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值