I have been searching for this almost all day. The general form of the log transformation is
s = clog(1+r)
where
c = 0.1
The opposite is inverse log transformation(book). What will be the inverse log transformation? Is it
s = exp(r)
?
Could not get right output.
Exp()
will only be an inverse of Log()
if Log()
is the natural logarithm. If your Log()
is using a different base (base 2, base 10, any other arbitrary base), then you will need to use the different base in place of e
in Exp()
.
Update
Try 10^(x/0.1)-1
. x/0.1
undoes the 0.1 *
operation, 10^
undoes the log()
, and -1
undoes the +1
.
I think you defined c
to normalize the resulting image to a valid (visible) range. Then a rational value for c
could be:
c = (L - 1)/log(L)
where L
is the number of gray levels. So s
would be:
s = log(r+1) .* ((L – 1)/log(L))
or
s = log(r+1) .* c
Then the inverted transformation would be:
s2 = (exp(r) .^ (log(L) / (L-1))) – 1
or
s2 = (exp(r) .^ (1/c)) – 1
This is the transformation output for L=256
:
To apply this transformation to an image we need to do some typecasting:
figure;
L = 256;
I = imread('cameraman.tif');
log_I = uint8(log(double(I)+1) .* ((L - 1)/log(L)));
exp_I = uint8((exp(double(I)) .^ (log(L) / (L-1))) - 1);
subplot(2, 2, [1 2]); imshow(I); title('Input');
subplot(2, 2, 3); imshow(log_I); title('\itlog(I)');
subplot(2, 2, 4); imshow(exp_I); title('\itexp(I)');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With