How to avoid needing the map for an image / permanently mapping an image
Info
This question is closed. Reopen it to edit or answer.
Show older comments
I want to read frames from an gif, them take those frames and convert each one into an array with values from -1,1. This should be simple but the frames of the image require a map to be displayed properly.
for k=1:1
[img,map] = imread('c:\Users\***\Desktop\name.gif','frames',k);
figure;
imshow(img,map);
end
If I do not have the map I get the following:

If I do have the map I get the following:

I just need to be able to convert the image from unit8 to a doulbe but I can't do this while maintaining the map. I've tried using intlut but the map is a 256 x 3 of doubles with number from 0 to 1 with 4 decimal places and intlut does not like this.
Thank you for reading.
1 Comment
KSSV
on 1 Sep 2017
How about converting the image to gray?
Answers (1)
Walter Roberson
on 1 Sep 2017
Edited: Walter Roberson
on 1 Sep 2017
gimg = rgb2gray( ind2rgb(img, map) );
scaled_img = im2double(gimg) * 2 - 1;
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!