Capture an image automatically without user input

Hey there, would it be possible to capture an image in the “background”. So without the user knowing an image was captured? I want to use this with a gate security app, where gate guards operating the device need to be identified. One suggestion was to capture the guy’s face, image recognition could then be done server side. But the first step would be to capture the guys face while he is using the app.

So basically capture the photo using the front camera, without showing the camera, and snapping the image programatically.

Cheers, thanks!