Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Algorithm to detect photo orientation

I would like to rotate photos automatically, even when EXIF metadata about the image orientation is not available.

Are there any good algorithms for detecting the orientation of a photo? The images are photographs from a digital camera. The algorithm doesn't have to work perfectly, but any reduction in the amount of human interaction required to properly rotate photos would be a benefit.

I have found these two papers on the topic:

  • Pre-Classification for Automatic Image Orientation (2006)
  • A Probabilistic Approach to Image Orientation Detection via Confidence-Based Integration of Low-Level and Semantic Cues (2004)

Pointers to other research and especially implementations are appreciated.

like image 431
Luke Francl Avatar asked Jul 17 '09 07:07

Luke Francl


People also ask

How do I know the orientation of an image?

The length of the longest side determines the orientation. For example, if the height of the image is longer than the width, it is a “portrait” format. Images where the width is longer are called “landscape.”

How does the camera know the orientation of the image when a picture is taken?

An orientation sensor is an electronic device built into the camera that can sense if the camera is held horizontally or vertically and if the camera is flipped or not (there are two vertical positions also known as 90 degrees or 270 degrees relative to the horizontal position).

What is Auto photo Orientation?

DSLR cameras are equipped with a built-in sensor that detects camera orientation. Information from this sensor is embedded in photographs as they are taken, allowing portrait (tall) orientation photographs to be rotated automatically when displayed in Nikon View, PictureProject or Nikon Capture 4.

How do you fix a digital picture that is sideways?

Right-click the image and select Details to reveal a screen with metadata, including EXIF data, that you can adjust if the image supports it. Force a preferred orientation. Rotate the image, then save it.


1 Answers

Many photographs from consumer digital cameras are of people, which could be used for orientation. Face detection is a well-studied research area. Basic face detection would give you a rectangle whose longer side should be the vertical dimension. Further, if you can detect the eyes/mouth, you should be able to pick the correct orientation of the rectangle.

Many other photographs are tourist snaps, where the sky is up and blue, and the ground is down and green.

like image 148
Scott McIntyre Avatar answered Sep 20 '22 10:09

Scott McIntyre