I use imageJ software, imageJ has a EXP command (process >math >exp ).

original image:


output image processed by EXP command in imageJ software:


in this link explain how do that ImageJ: http://imagej.1557.x6.nabble.com/Process-gt-Math-gt-Exp-td5009733.html

How can I do that in matlab?

It is the matlab code which I wrote,Please correct my mistakes.

clear all;
close all;


    for i=1:size(im,1)
        for j=1:size(im,2)

          in = (im(i,j)+1);
          result(i,j) = 255*exp(in/46.01);

  • $\begingroup$ dear @SergV the second image is this: s6.uplod.ir/i/00594/7znj3tzvefui.png you put the first image instead of first and second image. please edit it.thanks alot $\endgroup$ – Karo Amini May 8 '15 at 7:01
  • $\begingroup$ I change image by your request. Wait some time. But it was not my fault - maybe it was a some failure. Good luck. $\endgroup$ – SergV May 8 '15 at 8:05
  • $\begingroup$ You provide a link which describes very clear this function. What's your trouble? Could you give source in Matlab, with which you have tried to solve the problem? $\endgroup$ – SergV May 8 '15 at 8:08
  • $\begingroup$ Dear @SergV I added my source code :) , please help me and correct my mistakes. thanks alot again. and thanks for your time. (v) $\endgroup$ – Karo Amini May 8 '15 at 11:25

You have to learn to debug your programs. Try formula for some data:

>> 255*exp(255/46.01)
  ans =   6.5091e+004

So formula has bug (explanation in link to forum is valid. Read it carefully). Valid formula:

>> exp(255/46.01)
 ans =  255.26

But try calculation with real data from your image:

>> in = (im(10,10)+1)
in = 254
>> exp(in/46.01)
ans =  403.43    % very strange result!!!!
>> in/46.01
ans = 6          %what is it????

Reason is quite simple - type of in is uint8!!!

Valid formula:

result(i,j) = exp(double(in)/46.01);



enter image description here

| improve this answer | |
  • $\begingroup$ Dear @SergV ,I do appreciate you for what you have done for me. $\endgroup$ – Karo Amini May 8 '15 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.