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

1 回表示 (過去 30 日間)
Pranjal Pathak
Pranjal Pathak 2012 年 9 月 29 日
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 件のコメント
Ryan
Ryan 2012 年 9 月 29 日
do you mean an image that is a gradient that follows an exponential decay?

サインインしてコメントする。

回答 (1 件)

Image Analyst
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.

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by