How to avoid needing the map for an image / permanently mapping an image

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.

Answers (1)

gimg = rgb2gray( ind2rgb(img, map) );
scaled_img = im2double(gimg) * 2 - 1;

This question is closed.

Asked:

on 31 Aug 2017

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!