[Numpy-discussion] replace voids in 2d dat with nearest neighbour value

Jim Vickroy Jim.Vickroy@noaa....
Mon Apr 6 11:42:57 CDT 2009


Zachary Pincus wrote:
> Hi Christian,
>
> Check out this discussion from a little while ago on a very similar  
> issue (but in 3d):
> http://www.nabble.com/Help-with-interpolating-missing-values-from-a-3D-scanner-td21489413.html
>
> Most of the suggestions should be directly applicable.
>
> Zach
>   
Hi Christian,

I'm in the early stages of testing the scipy.interpolate.Rbf(...) 
<http://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.Rbf.html> 
function (one of the approaches Robert Kern suggested in the discussion 
Zach mentioned) for a not too dissimilar application -- replacing the 
bad pixels regions in Solar X-ray images captured by a damaged 
detector.  Preliminary results look promising for this application.

-- jv
>
> On Apr 6, 2009, at 9:01 AM, Christian K. wrote:
>
>   
>> Hi,
>>
>> I am looking for an elegant and fast way to fill the voids of a 2d  
>> array with
>> neighbouring values. The array's size can be up to (1000, 1000) and  
>> its values
>> are slowly varying around a mean value. What I call voids are values  
>> which are
>> far from the mean value (+- 80%). A void usually extends over some  
>> adjacent
>> coordinates.
>>
>> Currently I am using
>>
>> tmp = N.ma.array(tmp, tmp<threshold)
>> data[tmp.mask] = tmp.mean()
>>
>> which moves the voids closer to the mean value but which is still  
>> far from
>> beeing a smooth interpolation.
>>
>> Regards, Christian
>>
>>
>> _______________________________________________
>> Numpy-discussion mailing list
>> Numpy-discussion@scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>     
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090406/8afd170e/attachment.html 


More information about the Numpy-discussion mailing list