Homographies are really useful. Often I need to take pictures of a projection onto a surface and usually this results in some perspective distortion. Using cvFindHomography, giving 'control points', a homography can be calculated and then the image can be rectified using that homography with cvWarpPerspective.

I have written two small python scripts. find_homography to interactively select four points that should result in a rectangle and then calculating and saving the homography matrix to a file. Because I usually need some batch processing, I have also written a small script warp_homography to warp a whole series of input images using the same given homography matrix.