jim-easterbrook / python-gphoto2

Python interface to libgphoto2
GNU Lesser General Public License v3.0
368 stars 59 forks source link

multiple cameras #96

Closed Denidza closed 4 years ago

Denidza commented 4 years ago

Hi, I’m having difficulty using multiple cameras, in gphoto, you can specify the port when accessing the camera:

pi@raspberrypi:~/capture/examples $ gphoto2 --auto-detect Model Port

Canon EOS 1100D usb:001,016 Canon EOS 1100D usb:001,015

gphoto2 --port=usb:001,015 --capture-image-and-download --filename=cam001 New file is in location /capt0000.jpg on the camera Saving file as cam001 Deleting file /capt0000.jpg on the camera

Question! :

import gphoto2 as gp cameras = gp.check_result(gp.gp_camera_autodetect()) for name, value in cameras: ... print(name," --- ",value) ... Canon EOS 1100D --- usb:001,016 Canon EOS 1100D --- usb:001,015

How can I initialize each camera in different objects to work with them?

# Init camera1
camera1 = gp.Camera(?)
camera1.init()

# Init camera2
camera2 = gp.Camera(?)
camera2.init()
jim-easterbrook commented 4 years ago

See the choose-camera.py example.