Here is some simple Matlab image warping code that I wrote a while ago that others continue to find useful. The code requires that you have Matlab and the Image Processing Toolkit installed.
Results from using this code to fill in holes in images of faces can be found here .
>> captureWarpPoints('man11.jpg');This will bring two windows. The window on the left is the reference which shows which point to click on next indicated by the red dot. The window on the right is the capture window you click the mouse to capture the corresponding points. After you click the mouse to capture a point, the recorded point will appear as a red dot in the capture window and the reference window will show the next point to captured.
Once the two points files are captured run the warpRunner.m file to warp the image. Since in our example man11.jpg is the image we want to warp to man12.jpg we enter
>> warpRunner('man11.jpg', 'man11.jpg.pts.mat', 'man12.jpg.pts.mat');The warped image will be saved as warpman11.jpg.jpg. The default output file is jpg, however if one specifies another file format the file will be saved as that type. For example if we wanted to save the file as a bitmap we could enter
>> warpRunner('man11.jpg', 'man11.jpg.pts.mat', 'man12.jpg.pts.mat', 'bmp');
As far as warping faces is concerned, that's all there is to it. If you would like to warp objects other than faces, you can manually create the corresponding "points" files (which consists of cell arrays of 1 x 2 matracies containing the x, y coordinates) or modify captureWarpPoints.m.