Here’s a free tutorial on how an image containing buildings can be straightened and reshape into a more normal perspective using the Lens Correction filter in Photoshop
The Lens Correction filter is found within the group of Distort filters. The Lens Correction filter can perform multiple image edits, such as removing chromatic aberration and a vignette. But we’re using it for correcting perspective.
In the Lens Correction filter, choose the grid’s size to suit the buildings. A small grid will be hard to use and match to the buildings you’re trying to straighten. We had to enlarge the size to 36.
Firstly, use the Vertical Perspective slider down the right side of the filter to push back or tilt forward the building. Chances you’ll need tilt the building forward if shot looking up. Reduce the Vertical Pespective and use the grid overlay to line up the edges of the buildings until they’re vertical. You may lose some of the top part of the building at this stage, but don’t worry about that.
Now adjust the Horizontal Perspective slider to spin the image either left or right. This may only need adjusting slightly, however, but it tops of the effect and brings buidlings level to eye.
Now it’s time to level the horizon line. Pick the Straighten tool from the left side of the filter. Draw a line across an area of your image that is meant to dead level. This will slightly rotate your image to straighten it up with the horizon line.
You may, like us, have quite a bit of the image of screen. Use the Scale slider (the last one in the filter) to resize the image smaller. This brings in the extra bits such as the top of the building.
Hit OK in the filter and use the Crop tool to snip away at the edges. The unfortunate thing is that you’ll likely lose a lot of the image, but it’s level, nonetheless.