basler / pypylon

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

CameraFinder & Python doc #411

Open maximecharriere opened 3 years ago

maximecharriere commented 3 years ago

1st question In C# there is a CameraFinder to enumarate all connected cameras and emulators. Is there an equivalence in Python ?


2nd question As explained in some places, I can use the C++ doc for the Python wrapper. But I don't understand because many C++ examples don't work.

For example for camera emulation with custom images :

C++ doc

// ** Custom Test Images **
// Disable standard test images
camera.TestImageSelector.SetValue(TestImageSelector_Off);
// Enable custom test images
camera.ImageFileMode.SetValue(ImageFileMode_On);
// Load custom test image from disk
camera.ImageFilename.SetValue("c:\\images\\image1.png");

What I coded in Python based on the C++ doc and did not work

# ** Custom Test Images **
# Disable standard test images
camera.TestImageSelector.SetValue(pylon.TestImageSelector_Off)
# Enable custom test images
camera.ImageFileMode.SetValue(pylon.ImageFileMode_On)
# Load custom test image from disk
camera.ImageFilename.SetValue("c:\\images\\image1.png")

What I had to code in Python to make it work

# ** Custom Test Images **
# Disable standard test images
camera.TestImageSelector = "Off"
# Enable custom test images
camera.ImageFileMode = "On"
# Load custom test image from disk
camera.ImageFilename = "c:\\images\\image1.png"

Where can I find what to write to call methods and get/set values ? How do I know what methods and enums are available in python and how to write them ?

SMA2016a commented 3 years ago

1) Try following code Please refer to following code https://github.com/basler/pypylon/blob/master/samples/grabmultiplecameras.py

SMA2016a commented 3 years ago

2) Some parameter is not available on across the camera models. So you need to check with pylonviewer if the parameter available on your camera.

or via SDK e.g if genicam.IsAvailable(camera.Exposuretime):

thiesmoeller commented 3 years ago

See also https://github.com/basler/pypylon-samples for in depth samples and a webinar