basler / pypylon

The official python wrapper for the pylon Camera Software Suite
http://www.baslerweb.com
BSD 3-Clause "New" or "Revised" License
567 stars 207 forks source link

How to select which camera to use for the system - Multiprocess in Python? #584

Open nicolexi opened 1 year ago

nicolexi commented 1 year ago

For attaching the device to the program, I normally use the code: '''

Create and attach all Pylon Devices.

for i, cam in enumerate(cameras):
    cam.Attach(tlFactory.CreateDevice(devices[i]))

    # Print the model name of the camera.
    print("Using device ", cam.GetDeviceInfo().GetModelName())

''‘

Currently, I'm working on a multi-processing project which needs one process control two cameras to take videos, and other processes to do the post-processing. However, I found out that is hard to achieve, now I want to use one process to control one camera and create the camera device beginning of each process. Is there a way to select which camera to attach to the system? Thanks!

thiesmoeller commented 1 year ago

Please see our partner repository https://github.com/basler/pypylon-samples which contains samples how to select a specific camera.

Regarding multiprocessing there is an example in this ticket here: https://github.com/basler/pypylon/issues/513#issuecomment-1346405311