comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Median filter the hard way
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Median filter the hard way [message #36766] Thu, 16 October 2003 17:15
Peter Payzant is currently offline  Peter Payzant
Messages: 3
Registered: July 2003
Junior Member
Hello, all-

This is my first posting to the group. I'm a relative novice at IDL (though
not at programming), and I'm hoping that someone may be able to help me with
a problem that a colleague is having.

He is applying a median filter to a 2-dimensional image. In general, he
wants to build a new image, where each pixel is the median value of the 3 x
3 array centred on the corresponding pixel in the original image.
Unfortunately, the image is corrupted by missing data, which are represented
by NaN. If there less than 7 good values in the 3 x 3 array, he discards
the original pixel.

His code is something like this:

for each row in the image
for each pixel in the row
count the finite neighbours of the pixel
if the count is 7 or greater then
new_pixel = median value
else
new_pixel = NaN
next pixel
next row

Obviously, the nested loops are the source of the problem. Is there any
other way to accomplish this, in a more IDL-esque way?

Thanks

Peter Payzant
Waverley, NS Canada

pce "at" accesswave "dot" ca
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Has IDLDE screwed up my man pages?
Next Topic: Rotation of an IDLgrPolygon about a user specified axis

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 07:49:35 PDT 2025

Total time taken to generate the page: 0.31842 seconds