Discovery Park of America

 

 

 

 

The Importance of Straightness

The number of things that can go wrong when taking a picture is probably uncountable.  With all of the technological innovations that are built into cameras today, it should be almost impossible to mess up.  Modern autofocus, auto exposure, smile detection, etc. have drastically reduced the likelihood of most common mistakes.  However, I can think of one common mistake that I haven't heard any camera manufacturer claiming to have defeated—the crooked picture.  By 'crooked' I mean horizons that aren't horizontal, people that seem to be leaning to one side or the other, bodies of water that look like they should be draining off the side of the photo and that sort of thing.

If you aren't holding the camera straight, your picture won't be straight.  As I said, I haven't heard of a camera yet that claims to be smart enough to know better.  There probably will be such a camera one day, and I'll just bet that when that day comes there will be people trying to figure out how to turn that feature off saying, 'I meant for it to be crooked.'  Of course, most of the time we don't want our photos crooked.  That is the assumption of this article.  Unfortunately, if you are looking for advice on how to avoid taking a crooked picture I haven't found the answer yet.  What I can tell you is what happens when a photo isn't straight and you straighten it with software.

This article also makes the assumption that once a crooked photo has been rotated so that it is straight then it is cropped so that the final photo is once again rectangular in shape.  This cropping is necessary, but it has two potentially detrimental effects.  One is a loss of image.  When cropping a rotated photo, you will be discarding four triangular regions.  Depending on the content of the photo, any one of those regions may contain all or part of something which is very important to the picture.  Had the camera been held straight, the photographer could have zoomed in more, thereby throwing more megapixels at the subject.  (This assumes optical zoom and not digital zoom is used.)

Another potentially detrimental side effect of rotating and cropping is a resulting increase in the aspect ratio.  SLR cameras have an aspect ratio of 1.5 (or 3:2).  Consequently, if you print to a 4x6, there is no loss of image (i.e. no cropping necessary).  However, if a photo needs to be rotated by 1 degree, the photo will have an aspect ratio of 1.52 after it is cropped.  As mentioned earlier, four rectangular regions will have to be discarded.  In addition, a further 1.33% of the width must be cropped if the photo is to be printed to 4x6, resulting in a further loss of megapixels.  If it doesn't sound worth it, be advised that a photo in need of a one degree rotation can be surprisingly noticeable.

The more degrees of rotation necessary, the greater the aspect ratio after cropping.  Below, I will derive the formula for the resulting aspect ratio in terms of degrees of rotation.  Consider the diagram below.  The larger, black rectangle represents the boundaries of the photo as taken.  It has been rotated by α ('alpha') degrees as necessitated by the content of the photo.  The smaller, blue rectangle represents the boundaries of the resulting photo after cropping.  You can see that the blue rectangle has a greater aspect ratio than the black rectangle.  By applying trigonometric identities to the discarded triangles, in addition to observations about the various lengths and widths, we will derive a formula for the resulting aspect ratio in terms of degrees of rotation.

The original dimensions of the photo are defined as w1 and l1.  These are known values.  As noted, the original photo has been rotated by α, which is also a known value.  The dimensions of the resulting image after cropping as defined as w2 and l2.  By determining these values, the resulting aspect ratio follows as l2/w2.

We begin by applying a trigonometric identity involving two of our known values and only one unknown.  Observe that

tan α = o3 / l1

Solving for the unknown value, we write

o3 = l1tan α

Since we have a solution for o3 in terms of known values, we can treat o3 as a known value.  By observing that

w1 = o3 + a4

we have written another equation involving only one unknown.  Solving for the unknown, a4, we have

a4 = w1 - o3

We can now treat a4 as a known value, particularly if we go a step further by substituting the expression for o3 involving only l1 and α to write an equation for a4 in terms of only w1, l1, and α like so:

a4 = w1 - l1tan α

We continue chipping away at unknown values by applying another trigonometric identity involving just one unknown.  Observe that

tan α = o4 / a4

Solving the the unknown o4 gives us

o4 = a4tan α

Substituting our expression for a4 in terms of only w1, l1, and α we have o4 in terms of only w1, l1, and α:

o4 = (w1 - l1tan α)tan α

Notice that

sin α = o4 / w2

Also notice that the sole unknown in the above equation is w2, which happens to be one of the two values we set out to find.  Solving for w2 gives us

w2 = o4 / sin α

Substituting our expression for o4 in terms of only w1, l1, and α gives us

w2 = ((w1 - l1tan α)tan α) / sin α

The above equation for w2 involves only w1, l1, and α.  Now that's progress!  We only need to pull out one more equation involving an intermediate unknown.  Note that

l1 = o4 + a1

Solving for a1 results in

a1 = l1 - o4

Substituting for o4 gives

a1 = l1 - (w1 - l1tan α)tan α

One more trig identity:

cos α = a1 / l2

Notice that the above involves l2, the other value we set out to find.  Solving for l2 gives us

l2 = a1 / cos α

Substituting for a1 gives

l2 = (l1 - (w1 - l1tan α)tan α) / cos α

So the aspect ratio is

l2/w2 = ((l1 - (w1 - l1tan α)tan α) / cos α) / (((w1 - l1tan α)tan α) / sin α)

which simplifies to

l2/w2 = (l1 - (w1 - l1tan α)tan α) / (w1 - l1tan α)

Here is a plot of the function for a photo with an initial aspect ratio of 1.5:

As the angle of rotation increases, the cropping becomes more subjective.  This turns the formula into more of an estimate.  This chart is merely for illustrative purposes anyway.

 

 

Glossary