How can I make one side of a color image greyscale and then have the color gradually return to the other?

1 view (last 30 days)
I have a color image that I want to process in a very specific way. I need a code that can convert far lefthand side of the picture to the equivalent grey (so still in rgb format), and then have the color gradually return as you go right. I would also like to be able to set the point where the picture is completely restored.
Same question for the noise. Could I add some noise (make the picture grainy) in the same way - left side very noisy, then gradually the noise disappears until some point where it disappears completely?
Thank you all in advance.

Accepted Answer

Image Analyst
Image Analyst on 26 Nov 2013
In the hsv color space you could just multiply your saturation image by values going from 1 down to 0 to reduce the image to gray.
hsv = rgb2hsv(rgbImage);
hsv(:,:,2) = hsv(:,:,2)*reductionFactor;
newrgbImage = hsv2rgb(hsv);
or something similar. For the noise, just add different amounts of noise with imnoise. Not hard. Write back if you can't figure it out.

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!