Combining GIF images and colormaps to 3-D image arrays

大憨熊 提交于 2019-12-11 04:20:16

问题


When I read a color JPEG image:

jpgim = imread('path/to/image.jpg')

I get an MxNx3 array. However, with GIF files I also need to read the colormap:

[gifim, map] = imread('path/to/image2.gif')

Let's assume that I need only the first frame if the GIF image is animated: gifim = gifim(:,:,:,1) Is there a way to get a standard MxNx3 image array using gifim and map as that is what later parts of my processing pipeline expect?


回答1:


Use ind2rgb:

im = ind2rgb(gifim, map);


来源:https://stackoverflow.com/questions/16775495/combining-gif-images-and-colormaps-to-3-d-image-arrays

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