matlab - Splitting image into RGB channels with strange result -


i used matlab split 1 image rgb channel , export binary rgb image, following original image:

the original image

i split image rgb channel following code:

r = secretimg(:,:,1); g = secretimg(:,:,2); b = secretimg(:,:,3);  imwrite(r,'redchannel.tif'); imwrite(g,'greenchannel.tif'); imwrite(b,'bluechannel.tif'); 

however, following results: the result

as can see, in red channel binary image, cannot see colour red component, show blue; in blue channel, cannot see in blue component!

what happened?

this isn't strange. works should.

here simple illustration may easy understand

  • pure red    -> r-1 g-0 b-0.
  • pure green -> r-0 g-1 b-0.
  • pure blue    -> r-0 g-0 b-1.
  • white           -> r-1 g-1 b-1.
  • black           -> r-0 g-0 b-0.
  • gray            -> r-x g-x b-x. (x between 0-1 same components)

so when view red component image, don't see difference between white , red color both holds value 1.

similarly figure out reason missing blue foot print in blue component image.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -