Puppet Warp For Lens Correction
Press Command-J (PC: Ctrl-J) to duplicate the layer you want to correct, and navigate to Edit>Puppet Warp. Now, click to drop a pin in each corner to “lock” the image. Having done this, you can now lift horizon lines, straighten leaning buildings, etc.; you have exact control on small pieces of the image in a way you didn’t before. This is great for user-driven lens correction (useful for multi-image panos or images shot in perspective).
by Bryan O’Neil Hughes