1

I'm new in Matlab..

I have image with dimension 512x512x3 uint8. And I use 'dither' function like this :

[Myimagedither, Myimagedithermap] = rgb2ind(img, 16, 'dither'); 
imwrite(Myimagedither,Myimagedithermap,'step_4_RGB_D_U_16.tiff');

after that, I use imread to read the image like this :

new_img = imread('step_4_RGB_D_U_16.tiff');

but, after that dimension change into 512x512 unit8 only. I need to divide that image into R G B. Can anyone help me to solve this?

stranger
  • 189
  • 1
  • 3
  • 15

1 Answers1

1

You need to read the map seperatly. Like this:

[new_img new_img_map] = imread('step_4_RGB_D_U_16.tiff');

And then convert the image into rgb using ind2rgb() and divide the colorchannels into 3 seperate image. Like this:

new_img_RGB = ind2rgb(new_img,new_img_map);
g1_16 = new_img_RGB(:,:,1);
g2_16 = new_img_RGB(:,:,2);
g3_16 = new_img_RGB(:,:,3);
lennon310
  • 12,503
  • 11
  • 43
  • 61
Ghaul
  • 3,340
  • 1
  • 19
  • 24
  • thx for fast response, I see.. but after that I need to divide it into R-G-B like g1_16 = new_img(:,:,1); g2_16 = new_img(:,:,2); g3_16 = new_img(:,:,3); , how about that map? – stranger Aug 01 '14 at 12:01