Reputation: 1
My android application asks users to take their own photo. I want to ensure that the user does not take a photo of a physical picture or from another phone screen.
While turning on the flash would help(since a screen reflects light), I need to use the front camera which may not support flash.
Is there any way for me to accomplish this? I was wondering if setting the camera to focus on objects at correct distance (or for objects farther than 10 cm ) was possible.
Can I use getFocusDistances() or setFocusMode() methods of android (Camera.Parameters) to do this? How can I implement this?
Any other way to do this will also be great!
Thanks
Upvotes: 0
Views: 678
Reputation: 18107
In general, this is a very hard problem, so it's a question of how much work you want to do, and what scenarios you want to prevent.
On devices that support camera2 LIMITED or FULL hardware level, you can manually set the lens focus distance to far away, so that would make close-up images very blurry (but you can't expect users to hold the phone at the exact right distance for sharp images of their face).
But that just means the users need to print out a bigger face - you can fit one on a standard sheet of paper, so it's not very hard.
Really detecting that you're looking at a real face needs to do motion analysis at the least - see if the user's blinking, turning their head, etc.
Upvotes: 1