Hacker News new | ask | show | jobs
by secraetomani 2613 days ago
Surely someone can create a neural network that reorients the image, even if the Exif orientation is wrong (JPEG lets you can do this without re-encoding). Sounds like it should be a very simple problem for the vast majority of "regular" images.
3 comments

Or how about just use the damn exif information to orient it correctly as the article outlines? The actual article is far less interesting than what the title seems to imply. While the title suggests a problem with computer vision. This is more of a programmer logic error.
There are many times my phone detects I'm holding it horizontally while taking a picture, but I'm actually trying to take a vertical picture, and vice versa.

For those images, the exif information is technically correct, but actually wrong.

EXIF info is often missing or wrong. Photos that have been passed around, going through various services, apps, scanners, screenshots, etc. along the way, frequently have their EXIF info stripped (e.g., for privacy when exported or uploaded), written incorrectly originally (e.g., you scan an old B&W print, put it in sideways to fit in the scanner, and the scanner invisibly includes EXIF data assuming it was correctly oriented), or rewritten incorrectly (e.g., stripped EXIF is replaced with default orientation).
If exif information is incorrect, that's just programmer error at the firmware/library level.
exif is a bit of a swamp, and may well be missing entirely.
I've encountered plenty of pictures with incorrect EXIF orientation, mostly caused by holding the phone at a weird angle.

For example, if I hold the phone parallel with the ground (aimed at the floor), what is the correct EXIF orientation?

JPEG lossless rotation can only be done if the dimensions (height and width in px) of the image are multiples of MCU (typically 8x8 for 4:4:4 or 16x16 for 4:2:0).
For the uninitiated, MCU is not Marvel Cinematic Universe as the search results might try to confuse you. It's Minimum Coded Units, and a nice explanation is over here:

>https://www.impulseadventure.com/photo/rotation-partial-mcu....

Edit: the link also closed for me a forgotten open loop about the meaning of an annoying error message Windows XP era. Thanks for making me look it up!

ImpulseAdventure is THE place when I look for reference related to anything about JPEG.

He also has a very useful utility (I normally use it to check DCT table) called JPEGSnoop [1].

[1] https://www.impulseadventure.com/photo/jpeg-snoop.html

Sure, that's a good enough excuse. I look forward to defeating government facial recognition algorithms by holding my head at an angle.
Better (in this case) would be to use algorithms that take advantage of rotational symmetry. What do you do when the phone is at 45 degrees?