[SciPy-user] Thin plates for a 3D deformation field

Zachary Pincus zpincus@stanford....
Sun Oct 28 10:56:49 CDT 2007


Hi Matthieu,

See attached my (GPL, but ask if you want in a different license)  
code for thin-plate image warping in 2D. It's straight out of  
Bookstein, but has some simple changes to make it tolerably fast in  
python/numpy.

It still depends on ndimage for the image coordinate mapping (so that  
one can use the fancier interpolators available), but that's easy to  
remove. The basic code should work fine in 3D; I think only the  
interpolation of the coarse deformation grid to a finer grid (a hack  
anyway) is 2D specific.

Anyhow, it should give you somewhere to start, and a hint at various  
caveats (like needing to set the log of very small values to zero to  
keep the thin plate function from exploding at times).

Also, note that if you do choose to use the RBF module from scipy,  
you can just grab that file and put it into your code (modulo license  
restrictions) -- it doesn't depend on much else. Similarly, you could  
just grab Robert's delaunay scikit and incorporate that into your  
code so as not to have any dependencies.

Zach
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image_warp.py
Type: text/x-python-script
Size: 4754 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20071028/6f8c9c8f/attachment-0001.bin 
-------------- next part --------------


On Oct 28, 2007, at 11:12 AM, Matthieu Brucher wrote:

> Thank you Zachary and Robert.
> In fact, I've decided to implement my own version (I'll make it  
> available on the net, as it can be recurrent) based on the  
> Bookstein article on the subject.
> I could use the rbf module, but I've decided that the dependence on  
> scipy was not necessary (the function is needed at two places, not  
> more, and the real trick was to compute the coefficients for the  
> thin plates and then interpoling the field with it).
>
> Matthieu
>
> 2007/10/26, Matthieu Brucher <matthieu.brucher@gmail.com>: Hi,
>
> I wondered if someone knew of a package that allows the  
> interpolation of a 3D deformation field with thin plates (or in  
> fact with anything) based on a list of points and their associated  
> deformation field.
> If only 2D deformation field is supported by a package, I'll go for  
> it too ;)
>
> -- 
> French PhD student
> Website : http://miles.developpez.com/
> Blogs : http://matt.eifelle.com and http://blog.developpez.com/? 
> blog=92
>
>
>
> -- 
> French PhD student
> Website : http://miles.developpez.com/
> Blogs : http://matt.eifelle.com and http://blog.developpez.com/? 
> blog=92
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user



More information about the SciPy-user mailing list