Java-based driver to use the camera of an Android device to take pictures

basically, once I set up the camera on a rig at the proper distance and with optimal illumination I don’t want to have to touch the camera again, just flip through the many pages I need the images from to be OCRed later:

  1. you manually flip to the page you need to take pictures of;
  2. based on the GUI of the application (run from a PC or laptop) you instruct the device (connected through its USB port) to take the picture of the page
  3. you transfer the image to your computer/remove it from the device after the picture is taken
    and repeat for all pages which image’s your need. I will need one of those devices which can use the same USB cable to transfer data and power up.
    Most probably someone has already put these pieces together for that or a similar purpose. Do you know of anything like that? Any suggestions or documentation you would share?
    Thank you, lbrtchx

I feel like you could do something like this with pure adb commands (maybe slight automation with python/javascript or some other scripting language of choice)

I’ve done in the past a “screenshot and transfer” automation for QA

adb -s ${device.serial} pull /sdcard/screen.png ${Path.join(saveLoc, screenshotName)}
adb -s ${device.serial} shell rm /sdcard/screen.png```
Something like that

So my initial thought would be to just open camera, send a swipe/press with adb to where the button is on screen, then look for the newest file and pull it?