Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question java-based driver to use the camera of an Android device to take pictures ...

Discussion in 'Android' started by lbrtchx, Apr 24, 2024.

  1. lbrtchx

    lbrtchx

    Joined:
    Apr 24, 2024
    Posts:
    1
    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
     
  2. Evaldas_Unity

    Evaldas_Unity

    Unity Technologies

    Joined:
    Jun 23, 2016
    Posts:
    92
    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} shell screencap -p /sdcard/screen.png
    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?