Issues with greyscale png images in matlab
2 次查看(过去 30 天)
显示 更早的评论
I have a number of greyscale png images of faces (from a free dataset) that I am using as part of a Psychtoolbox experiment. In photo apps such as preview they all look okay, but when I open them in MATLAB several of them are pixelated and the colours are off so they are unusable (see attached photos). Any suggestions as to why this might be?
Thanks!
2 个评论
采纳的回答
Dave B
2021-10-18
编辑:Dave B
2021-10-18
This looks like the result of loading an indexed image, you can read the colormap using the second output of imread:
[img,cmap]=imread('image.png');
imshow(img,cmap)
img_rgb = ind2rgb(img,cmap);
imshow(img_rgb)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!