Viewing .pgm images in Matlab

*爱你&永不变心* 提交于 2019-12-10 16:26:07

问题


I have been provided with a dataset consisting of .pgm images to be used for some coding in Matlab. I was just wondering if it is possible to view the same image as a .jpeg/.png in Matlab itself?

Thanks


回答1:


To visualize the image in matlab,

imshow(imread('im.pgm'))

To convert the image from pgm to jpeg:

imwrite(imread('im.pgm'),'im.jpg')



回答2:


The MathWorks docs on imread seem to suggest Matlab can read in a pgm file.

Showing it should be a matter of using imshow on the resulting array returned by imread.



来源:https://stackoverflow.com/questions/9823854/viewing-pgm-images-in-matlab

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!