Enhance image in matlab - exp operation - imageJ software-LPR 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;
clc;
img=imread('http://s6.uplod.ir/i/00594/fdg3933aznwz.jpg');
im=rgb2gray(img);
im=im2double(im);

figure,imshow(im)

    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);

        end
    end
figure,imshow(mat2gray(result))
You have to learn to debug your programs. Try formula for some data:

&gt;&gt; 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:

&gt;&gt; exp(255/46.01)
 ans =  255.26


But try calculation with real data from your image:

&gt;&gt; in = (im(10,10)+1)
in = 254
&gt;&gt; exp(in/46.01)
ans =  403.43    % very strange result!!!!
&gt;&gt; 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);


result:

imshow(uint8(result));