I’m a bit of a novice, needing to do this for a university project. I need to connect two USB webcams to the RPi and get each to take a still image and save it in “%iimg%i” naming notation to identify the image and the camera it come from. The images are saved onto a USB drive. This all has to run from a script that runs automatically on startup.
Any suggestions as to how to address the cameras as separate entities? And they don’t need to be full colour nor do I need to stream video so any way I can cut down on the data size too, aside from resolution?
EDIT: I'm working on a simple fswebcam function following the advice from Bierschi:
# Install fswebcam on RPi: sudo apt-get install fswebcam # fswebcam allows for basic photography from a specified device # ASSUMING CAMERAS 0 AND 1 str DIRECTORY = "" #path to write to (undefined) int takePhoto (int cam, int num): if cam == 0: str command = "fswebcam -d /dev/video0 -r 640x480 --no-banner --png " + DIRECTORY + "/1img" + num + ".png" os.system (command) else: str commamd = "fswebcam -d /dev/video1 -r 640x480 --no-banner --png --flip h " + DIRECTORY + "/2img" + num + ".png" os.system (command) return 0
Would this activate the cameras correctly? I believe my implementation of the strings is correct.