3

I'm trying to use the wiener denoise function from Scipy in a grayscale image:

image = data.imread(image_path, as_grey=True)
image = signal.wiener(image)

but I always get this warning:

/usr/lib/python2.7/dist-packages/scipy/signal/signaltools.py:425: RuntimeWarning: divide by zero encountered in true_divide
      res *= (1 - noise / lVar)
    /usr/lib/python2.7/dist-packages/scipy/signal/signaltools.py:425: RuntimeWarning: invalid value encountered in multiply
      res *= (1 - noise / lVar)

The filter works fine, but why I get this warning?

rriccilopes
  • 399
  • 2
  • 10

1 Answers1

1

Try to convert the data type of input image to float32 or float64, that is:

image = image.astype('float64')
image = signal.wiener(image)

I guess we countered the "divided by zero" as the underflow number.

wllbll
  • 531
  • 5
  • 11