[Image-SIG] Remove Noise from a National Weather Service Radar Image (.gif)

David Berthelot d_berthelot at yahoo.com
Sat Apr 18 20:50:52 CEST 2009

I do some pretty fancy image manipulation at the pixel level too. 
What I do is that I use numpy arrays to store images and perform all my math stuff on them.

import Image
import numpy as N
f = Image.open("image.gif")
g = N.array(N.asarray(f))
print g.shape

for y in xrange(g.shape[0]):
  for x in xrange(g.shape[1]):
     print "pixel",x,y,g[y,x]
     # You can change the pixel value, here I just increment the red channel by one
       if g[y,x,0] < 255:
       g[y,x,0] += 1
f2 = Image.fromarray(N.array(N.clip(g,0,255),'uint8'))

Hope this helps,

----- Original Message ----
From: J.D. Main <jdmain at comcast.net>
To: image-sig at python.org
Sent: Saturday, April 18, 2009 7:54:34 AM
Subject: [Image-SIG] Remove Noise from a National Weather Service Radar Image (.gif)


I have a desire to work with National Weather Service Radar Images.  In the 
United State the NWS provides a service where GIF images are updated 
every 5 minutes or so with the latest snapshot from a dopler radar site

Here's a URL explaining all this:  http://radar.weather.gov/GIS.html

In short these images are GIF files with a 256 color pallete.  The 
"interesting" pixels in these images are red, green, yellow and blue.

The pixels representing radar "noise" usually appear as brown, grey, and 

My desire is to iterate over all pixels and remove the noise.  The pseudo 
code would look something like this:

for pixel in radar_image:
   if pixel is noise:
      turn pixel white
      do nothing

I'm having a hard time with this.  Can anyone provide some insight into a 
method?  It would be greatly appreciated.  



Image-SIG maillist  -  Image-SIG at python.org


More information about the Image-SIG mailing list