Re: HELP: replace missing value with closest good pixel [message #4513 is a reply to message #4508] |
Wed, 14 June 1995 00:00  |
sterner
Messages: 106 Registered: February 1991
|
Senior Member |
|
|
knight@ll.mit.edu writes:
> I have 2-D images with flaws, i.e., missing pixels. I want to replace each
> missing pixel with the closest good pixel. Does anybody have a routine to do
> this? For example,
> new = replace(image,missing=99)
> where
> image = 2-D array
> missing = keyword to specify the value which is to be replaced
> new = image with each pixel having value 99 replaced by closest pixel
> with a value not equal to 99.
Here's a simple technique that seems to work well.
new = image
w = where(new eq missing)
m = median(new,3)
new(w) = m(w)
The median filter does a nice job filling in the missing pixels
(if the missing value is outside the range for good pixels).
The size of the filter can be adjusted for the severity of the
missing data. Only the missing pixels are modified, the rest of the
image is untouched.
Ray Sterner sterner@tesla.jhuapl.edu
The Johns Hopkins University North latitude 39.16 degrees.
Applied Physics Laboratory West longitude 76.90 degrees.
Laurel, MD 20723-6099
WWW Home page: ftp://fermi.jhuapl.edu/www/s1r/people/res/res.html
|
|
|