In a recent project you need to use the image deformation, read some papers, said that almost all the biological related deformation can be used to approximate the thin plate spline difference. As a result, I searched the web for the code of the thin plate spline difference.
Http://elonen.iki.fi/code/tpsdemo/has the C + + code for TPS. This code can be run (you have to configure OpenGL and boost), but there is only one 3D version of the demo, 2D version only wrote an interface, and did not write the demo. And I wrote this project in Java. So, in accordance with the C + + 2D version of the code to write a copy of the Java version of the Code, in order to facilitate everyone to learn, and wrote a demo. Want to be able to help the needy friends.
Because of the matrix operations involved in the code, I borrowed a library of another Java matrix operation: JAMA. Link http://math.nist.gov/javanumerics/jama/
Below a few pictures, the initial lattice as shown in the plane to press the mouse, create a control point, and then to hold down the mouse drag, release points for this control point after the deformation of the corresponding point. (Note: Be sure to drag, click the mouse is no use!) )
Initial dot Matrix:
Three control points:
Four control points:
Five control points:
The code threw it on the csdn http://download.csdn.net/detail/xiayang1023/8278687.
Thin plate spline difference (Thin plate spline) Java implementation