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.

Example:
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'))
f2.save("new_image.gif")

Hope this helps,
David


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

Hello,

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 
purple.

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
   else:
      do nothing

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

Thanks!

J.D.


_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig



      
_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to