How To Generate A Gray Level Exponential Decay Image Using Matlab.

1 view (last 30 days)
Hi,
Can anyone help me in generating a gray level exponential decay image(suppose decaying with time) using matlab? The limit can be set according to your preference.
Thanks!

Answers (1)

Image Analyst
Image Analyst on 29 Sep 2012
Is this a homework? Does it want you to take some gray scale image, then have several steps of time where each step you multiply the image by exp(-stepNumber * decayFactor)? Easy enough to do. You'll get a floating point image as the result, so make sure you use [0 255] when displaying it so you'll see the effect.
imshow(decayedImage, [0 255]);
Otherwise all you'll see will be all white because the values will be > 1 and it expects floating point images to be in the range 0-1, unless you override it with a specified range like I did. Just put the above line in a loop over stepNumber where you increase that and the image gets darker. Here's a little snippet of code that you might want to put in your for loop near the bottom of it:
promptMessage = sprintf('Do you want to Continue processing,\nor Cancel to abort processing?');
titleBarCaption = 'Continue?';
button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Cancel', 'Continue');
if strcmp(button, 'Cancel')
break;
end
Well that's a lot of hints - more than enough to let you make a little demo. Write back with your code if you run into any problems.

Categories

Find more on Images 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!