2

my question is what to do to detect image orientation when exif data don't exist or don't have rotation value.

Example : photo from mobile phone

<?php echo exec('exiftool -Orientation file 2>&1'); 
// MOBILE -> returns -> Orientation : Rotate 90 CW
// DSLR -> returns -> empty ?>

When I try this

echo exif_read_data($multimedia_newPATH)['Orientation']
// Mobile Phone -> 6
// DSLR -> value 1 (horizontal and/or vertical) gives same 1

EDIT Many DSLR write orientation 1 (normal) for both when camera is horizon or vertical, so a normal php script would "think" there is no rotation to perform.

so is there a orientation algorithm or orientation recognition script ???? (face recognition exists, but is there orientation recognition ?)

*** note ; exiftool is in perl modules (Image::ExifTool) in WHM...

Jintor
  • 607
  • 8
  • 32
  • Which image format is used? JPEG? – odan Jul 10 '19 at 05:52
  • @odan yes jpg, Many DSLR write orientation 1 (normal) for both when cam horizon or vertical, so a normal php script would "think" there is no rotation to perform... – Jintor Jul 10 '19 at 14:02
  • Sorry for going off topic, but might I ask what camera you are using that does this? I've never heard of a DSLR that didn't have a sensor to keep track of the orientation. Even old point and click cameras I've used have the ability to detect the orientation. – StarGeek Jul 10 '19 at 15:38
  • "recognition" of orientation is far easier than of faces: you just check the width against the height of the image. If width is larger, the it's landscape. Otherwise, it's portrait (unless they're equal, of course). – L. Scott Johnson Jul 11 '19 at 13:36
  • 1
    @l-scott-johnson the camera I tested (canon rebel 7D) does 6000x4000 in both cases horizontal AND vertical and orientation=1 in both cases as well, so how can the php script know if it's landscape ? – Jintor Jul 11 '19 at 16:48

1 Answers1

1

RotNet is a neural-network-based algorithm that does automatic image orientation and rotation.

Source: https://github.com/d4nst/RotNet

Description: https://d4nst.github.io/2017/01/12/image-orientation/

Google has also done some work on this problem, combining neural nets with using Captcha to crowd source the "difficult" cases.

L. Scott Johnson
  • 4,213
  • 2
  • 17
  • 28