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

조회 수: 1 (최근 30일)
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.

채택된 답변

Image Analyst
Image Analyst 2013년 11월 26일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by