Re: Interpolation of missing data [message #10736] |
Thu, 22 January 1998 00:00  |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
rkj@dukebar.crml.uab.edu (R. Kyle Justice) writes:
> mirko_vukovic@notes.mrc.sony.com wrote:
> : In article <6a2t1p$mfd@maze.dpo.uab.edu>,
> : rkj@dukebar.crml.uab.edu (R. Kyle Justice) wrote:
> : >
> : > I have a 2-D array with missing data. Is there an easy way to
> : > interpolate the missing values?
> : >
> : > I would like to replace a missing value with the average of
> : > its neighbors.
> : >
> : > Kyle J.
> : I found the median_filter (under image processing applications)
> : usefull in similar situations.
> : good luck,
> : mirko
> The only problem here is that the median filter ignores boundary
> values. That is, if the missing value to be replaced is on the
> edge of the "image" I am out of luck. Is it supposed to do this???
Yes, unfortunately.
At one point I wrote a routine called fmedian which did the same thing as the
built-in median function, but with smoothly decreasing filter width at the
edges. It also allows for different widths in the two spatial directions. You
can find the routine at
http://sohowww.nascom.nasa.gov/solarsoft/gen/idl/util/
ftp://sohoftp.nascom.nasa.gov/solarsoft/gen/idl/util/
You'll need both fmedian.pro and fmedian_slow.pro. There's also some
CALL_EXTERNAL software to speed up the routine at /gen/idl_external. It's
written in Fortran--sorry. The routine will work, however, without the
CALL_EXTERNAL support--it'll just be slower.
A different way to do almost the same thing with the built-in median procedure
would be to embed your image in a bigger image with appropriate data at the
edges. Take the median of the bigger image, and then throw away the edges.
The trick would be to figure out what data to put at the edges of the bigger
image before taking the median filter.
Bill
|
|
|