Thursday 26 December 2013

Correcting Scale After Perspective Adjustment

Introduction

When photographing buildings it is common to have to tilt the camera upwards in order to fit the top of the building into frame. This of course causes the verticals to converge, as in this example.

This can be used to good dramatic effect, but usually it is an unwanted side-effect of the camera to subject geometry. By stretching the top of the image (using, say, the perspective adjustment transformation in PhotoShop) the verticals can be restored.

This is a definite improvement, but now the image looks 'squat'. It needs stretching vertically to restore the natural proportions of the windows and the people.

Obviously this 'foreshortening' effect is more readily apparent with some subjects than others. It is nevertheless worth understanding the effect so that the image's deviation from reality is under the control of the photographer, not the equipment.


This final version of the street scene has been vertically stretched by 35%, but without obvious reference points (such as circles and squares) how can we know after the fact what the appropriate proportions are. We can achieve something aesthetically pleasing 'by eye' but minor geometric errors can leave an image somewhat disquieting. Fine photography often relies on the cumulative effect of many, individually indiscernible, tweaks. Relying on adjustments judged 'by eye' alone risks sacrificing the final image quality.

So here, I am investigating the relationship between the degree of perspective correction and the degree of stretch the resulting image requires.

Investigation

For this investigation I need a subject of known geometry, so I drew up a shooting target consisting of a grid of 2.5cm squares with a large circle overlaid. This I placed almost parallel to a camera sensor and I took a series of shots at increasing angles of recline.


I then followed the following method for each of the 8 shots.

First the original shot is duplicated onto a new layer and a perspective adjustment applied to correct the converging verticals. This layer was coloured yellow on black (using a Photo Filter layer adjustment) and set to layer blending mode 'difference' – so that it can be seen in comparison with the original shot.






Secondly the degree of adjustment was determined. By taking one of the adjusted verticals compared to its original placement a right-angle triangle can be prescribed. The ruler's units were set to display pixels and the magnification was set to actual size. In this way the length of the opposite and adjacent sides of the triangle could be measured. The Degree of adjustment (A) is then given by:

    Tan(A) = opposite/adjacent





Thirdly, looking only at the perspective adjusted layer the foreshortening of the circle is clearly apparent. By comparing the height to the width a scaling factor for the vertical dimension can be easily determined – i.e. by how much we need to stretch the image to restore the circle that had originally been shot at an angle.




The perspective adjustment layer was duplicated and the calculated sale factor applied. The scaled layer was coloured and blended in a manner similar to that used for the perspective adjustment layer. The comparison of the original as shot (angled circle) and the final image is shown.





The following table shows the measured relationship between angle of perspective adjustment and required scaling:

Angle Of AdjustmentScaling Factor
1.91.03
3.11.1
51.22
61.3
7.41.42
9.71.67
121.97
26.34.55


A least squares regression (LINEST function in Excel) determines a straight line fit for this data of:

    Scaling Factor = 0.092 * Angle + 0.793

Or perhaps more readily helpful, although less accurate:

    Scaling Factor = (Angle + 8)/10

Conclusions

For perspective adjustments of three degrees or more the foreshortening effect is significant.

For adjustments of more than eight degrees the foreshortening is severe. Total recovery may not be advisable as interpolation effects will degrade the final image significantly.

Images that contain objects that have readily recognisable proportions (standard doors, windows, people for example) will suffer from perspective adjustments that are not consequently scaled in the appropriate direction.