将GIF图像和颜色图组合到3-D图像阵列 [英] Combining GIF images and colormaps to 3-D image arrays

查看:90
本文介绍了将GIF图像和颜色图组合到3-D图像阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我读取彩色JPEG图像时:

When I read a color JPEG image:

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

我得到一个MxNx3阵列.但是,对于GIF文件,我还需要读取颜色图 :

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

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

让我们假设如果GIF图像是动画的,则我只需要第一帧:gifim = gifim(:,:,:,1)有没有一种方法可以使用gifimmap获得标准的MxNx3图像阵列,因为这是我后期处理的内容管道期望吗?

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?

推荐答案

使用 ind2rgb :

im = ind2rgb(gifim, map);

这篇关于将GIF图像和颜色图组合到3-D图像阵列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆