MATLAB Answers

Billy

Change the intensity of blue in a .jpg

Asked by Billy
on 20 Nov 2012

Hello, how do I change the blue intensity of a .jpg so that the new image is combination of rg and the new b. Thanks.

  0 Comments

1 Answer

Answer by Image Analyst
on 20 Nov 2012
 Accepted answer
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Now change the blue channel in whatever way you want.
blueChannel = whatever.........
% Then recombine into the new color image.
rgbImage = cat(3, redChannel, greenChannel, blueChannel);

  6 Comments

Billy
on 20 Nov 2012

Oh the IM is the same as this rgbImage. Thank you very much to the both of you, sorry for being redundant. One last question. How do I display this new image, I am not sure how I piece together your answer and the one I received here. Thanks again.

Image Analyst
on 20 Nov 2012
blueChannel = uint8(single(blueChannel) + 255*BX/100);

Then recombine and show the final image:

imshow(rgbImage);
Billy
on 20 Nov 2012

Thank You VERY Much. That saved a lot of headache.


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today