How do I separate RBG channel then combine green and blue channel only, leaving the red channel out? Thanks!

I have tried separating the RGB colour channel. Since it is using dark channel for underwater images, the red channel could be ignored completely. Is there any to remove the red channel in the RGB channel and implement the blue and green channel only?

1 Comment

What is a dark channel? For that matter, what is a RGB channel?
You have RGB images that consist of 3 colour channels, red, green and blue. Or you have greyscale images that consist of 1 channel: the intensity.

Sign in to comment.

 Accepted Answer

What do you expect as output?
RGB = rand(640, 480, 3);
GB = RGB;
GB(:, :, 1) = 0; % Or 1?
% Or
GB2 = RGB(:, :, 2:3);

3 Comments

The output is to redefine the dark channel for underwater, thus instead of having red, blue, green channel, only blue and green channel would be used instead.
The code does work for for defining GB and GB2.
But may I know how does it work to take the maximum green and blue channel light intensity and to subtract it from the maximum light intensity of red channel too?
Thanks!
G = RGB(:, :, 2);
B = RGB(:, :, 3);
maxG = max(G(:));
maxB = max(B(:));
And now you want to subtract it from the maximum value of the red channel? Why? This sounds very strange.
Note that you can get very bright images with blue and green channels, therefore I'm not sure what you mean by "dark channel". Perhaps it would be useful if you explain, what you want to achieve. Some member of this forum have high skills in image analysis and might add more than the simple answer I've posted.
I'm trying to implement this on underwater images. Since the colour red will be attenuated, the dark channel will be redefined, using only the green and blue colour channel. The equation is like this
Maximum intensity of the blue and dark channel. The equation is like this
Dark channel prior is a method to remove noises from hazed images and I'm trying to use this concept on underwater images. Any clue on that?

Sign in to comment.

More Answers (1)

Well, you certainly can manipulate the image pixels using only two colour channels:
GB = RGB(:, :, [2 3]); %two channel pixel matrix
However, I'm not aware of any image file format that support only two channels and certainly your display needs to set an intensity for the red pixels even if it's 0, so you will have to add this red channel back for display or saving to standard image formats.
GBforsaving = cat(3, zeros(size(RGB, 1), size(RGB, 2), 'like', GB), GB) %add red channel with 0 value (no red).
So in the end, I would do what Jan's advised initially: just set the red channel with 0, and use that:
GB = RGB;
GB(:, :, 1) = 0;

Tags

Asked:

on 8 Feb 2017

Edited:

on 8 Feb 2017

Community Treasure Hunt

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

Start Hunting!