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:
Pointers to other research and especially implementations are appreciated.
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.”
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).
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With