In this paper, logarithmic transformation is offered to convert multiplicative noise in an image to additive noise before applying other filters.
logR(x,y) = log[O(x,y)×M(x,y)] = log{O(x,y)} + log{M(x,y)} = L(x,y) + S(x,y)
where F(x,y), L(x,y) and S(x,y) are the logarithms of R(x,y), O(x,y), and M(x,y), respectively.
However, I am confused about whether they just meant applying log transformation to the speckled image like below:
img_log = (np.log(img+1)/(np.log(1+np.max(img))))*255
Thanks in advance.
log(img+1)
is not the same as log(img)
. Follow the equation you got. If a pixel is 0, then log(img)
will be -infinity
for that pixel. This is OK:
0 * noise = 0
==> -infinity + log(noise) = -infinity
If you add 1, you break the concept.
Also, no, you don’t need to scale the result of the logarithm. log(img)
should be a floating-point image, don’t try to do complex arithmetic with integers. After filtering and back-transformation through exp(.)
, you should have an image that is in the 0-255 range again, and can be converted to uint8, displayed, and/or saved like a regular image.