[SciPy-User] Antwort: Re: scipy.interpolate.interp2d too many data values..
markus.proeller at ifm.com
markus.proeller at ifm.com
Fri Sep 4 05:33:12 EDT 2009
>> I tried to make an interpolation over an 800x600 image with the
interp2d
>> function from scipy,
>> but I get an error message, that this are "Too many data points to
>> interpolate".
>> It doesn't seem that much data to me. Am I doing anything wrong or how
>> many data does this function support?
>
>Interp2d is mainly meant for interpolation of scattered data, and yes, it
>has quite low limits on what it handles. It might be possible to bump
>these upwards, though.
>
>For interpolation of images that are specified on a regular grid, look at
>scipy.ndimage, especially map_coordinates.
Yes, that's what I was looking for. How do you actaully use it for a RGB
image?
I used the example from http://www.scipy.org/Cookbook/Interpolation but I
don't understand how it works for 3-D coordinates.
I want to apply the same remapping stored in y_new, x_new arrays with 2-D
shape for the 3 channels. Until now I just understand like
>>> coords = array([y_new, x_new])
>>> r = map_coordinates(img_org[:,:,0], coords )
>>> g = map_coordinates(img_org[:,:,1], coords )
>>> b = map_coordinates(img_org[:,:,2], coords )
>>> img = dstack((r,g,b))
But it seems that it can be done shorter...
Thanks,
Markus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20090904/77819c5b/attachment.html>
More information about the SciPy-User
mailing list