MATLAB: How to enhance blue color alone of an image

colorenhancementImage Processing Toolbox

how to enhance blue color alone of an image?

Best Answer

This question is vague, but I'll try to help. First off, don't just modify the blue sepearation. That will shift everything toward blue, including gray pixels, and I don't think that's your intent, so ignore Jan's suggestion above.
Color images are often rgb, that is img(:,:,1) is the red, img(:,:,2) is green, and img(:,:,3) is blue. By 'blue color alone', I imagine you are wanting to adjust pixels that are predominantly blue to become 'more so'.
Note: crudly, r+g+b = the gray component, cyan = g+b, magenta=r+b, and yellow=red+green
% get components r=img(:,:,1); g=img(:,:,2); b= img(:,:,3);
% When there is more blue than anything else, find out by how much extra_blue = max(b-max(r,g),0);
Now, you can try to add additional blueish component, as long as you stay in the valid range.
b_mod = min(b + k*extra_blue),1); % k is a scale of the amount of extra blue to add, say 0.1 for example
Alternatively, you can add the extra blue and scale down the non-blue components. Reduce r, g, and (b-extra_blue) by the exact same scale factor (say 0.9), that will maintain gray and all hue angles, then add a multiple of the excess blue (say 1.1) to the b channel.
There are much better ways, but then I'd have to ask you about hue angle, saturation, and it gets complicated quickly... I've said enough. I hope this helps.
Related Question