How To Generate A Gray Level Exponential Decay Image Using Matlab.
2 次查看(过去 30 天)
显示 更早的评论
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!
1 个评论
回答(1 个)
Image Analyst
2012-9-29
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!