Jintor
Jintor

Reputation: 657

php detect image orientation "without exif"?

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

Upvotes: 2

Views: 1325

Answers (1)

L. Scott Johnson
L. Scott Johnson

Reputation: 4382

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.

Upvotes: 1

Related Questions