We, now try to apply s = c log(1+r) transformation to an image. It's smillar to negative of an image. The only difference is in the for loops.
We should replace line B(k,l) = (L-A(k,l)); with B(k,l) = c*log(1 + (A(k,l))); which applies the log transform that converts narrow range of low intensity values to a wider range intensity values. Notice that in the log function I have high values of output for the low values of the input and the oppsite for inverse log function.
function [B] =LogTransform(A)
A = double(A);
[row,cols] = size (A);
%Function coefficient
c = 1;
for k = 1 : row
for l = 1 : cols
%Outputs from the log function is
%assigned to output array
B(k,l) = c*log(1 + (A(k,l)));
end
end
end
| Before Log Transform |
| After Log Transform |
No comments:
Post a Comment