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...

5
  • Which image format is used? JPEG? Commented Jul 10, 2019 at 5: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... Commented Jul 10, 2019 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. Commented Jul 10, 2019 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). Commented Jul 11, 2019 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 ? Commented Jul 11, 2019 at 16:48

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Cool, thanks ;) the article looks good, I'll do some tests on it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.