[SciPy-User] Image with black points

Zachary Pincus zachary.pincus at yale.edu
Mon Apr 25 13:15:50 EDT 2011


On Apr 24, 2011, at 10:22 PM, Paulo Henrique Junqueira Amorim wrote:

> Hi,
>
> I'm computing the 1D fft from image, and saving the image of  
> frequency.
>
> But the saved image appears black point's (example image), it seems  
> that do not belong.
>
> Is this correct? How could I remove it?
>
> Example image - http://img818.imageshack.us/i/fftthreshold.png/
>
> Code:
>
> import scipy
> import numpy
>
> r = scipy.misc.pilutil.imread('face.jpg', 'F')
>
> fft = numpy.fft.fftshift(numpy.fft.fft(r).real)
> fft_2d = numpy.log10(numpy.abs(fft))
> pil_array = scipy.misc.pilutil.toimage(fft_2d)
>
> scipy.misc.pilutil.imsave('fft.tif', pil_array)
>

If you could provide the input image that would be helpful for people  
trying to determine what the issue is.

As a stab in the dark -- have you checked (from python) what the  
values of at the "black points" are? Are they NaNs? (Perhaps from the  
log10 operation?)

Zach



More information about the SciPy-User mailing list