I want to detect programmatically whether a picture was taken with:
- a front-facing camera,
- a rear-facing camera,
- or whether we can not tell.
Is there a library for that?
- Works offline.
- Open source.
- It is for an Android app, so bonus for Java, but I can also do the porting so don't hesitate to post solutions in other languages.
- Works with JPG's EXIF, bonus for other formats. Alternatively it could take EXIF properties values as input.
- Reasonably fast, the detection should take less than a second once the image's data is loaded.
- Aiming for around 97% reliability (excluding "we can not tell" cases).
- Below 500 kilobytes.
The app is running on the phone that took the picture, solutions that take advantage of this fact are acceptable too.
Context: People usually take very different pictures depending on front/rear, so that would give my app very important hints.
Since EXIF does not seem to have a property for front/back, a solution could embed a database of phone models and guess from the model name and lens resolution as tipped at https://photo.stackexchange.com/questions/79179/rear-or-front-facing-camera-through-exif-data , OpenData question about such a database: https://opendata.stackexchange.com/questions/13581/focal-length-of-both-front-and-back-cameras-of-popular-smartphones