basler / pypylon-samples

BSD 3-Clause "New" or "Revised" License
40 stars 14 forks source link

What is the API for manual exposure, gain and white balance? #3

Closed pauljurczak closed 1 year ago

pauljurczak commented 1 year ago

I read all the examples and found only exposure and gain setting API:

    camera.Gain = 0
    camera.ExposureTime = 2000
    img = camera.GrabOne(1000)

I would like to make sure these settings will not be overridden by auto-exposure and auto-gain functions. I also need to set white balance manually and can't find an API for this.

thiesmoeller commented 1 year ago

Hi @pauljurczak,

any feature of your camera is available in pypylon.

If you have some time, can really recommend to see the webinar referenced in the README. There I explain, how pypylon automatically adapts to the feature set of the camera and how to get used to working with the pypylon by developing in jupyter notebook environment. There you can use simple autocompletion to use the right feature names.

Best start is to get used to the features of your camera using the PylonViewer ( part of the full install of pylon SDK https://www.baslerweb.com/en/products/basler-pylon-camera-software-suite/pylon-sdks/ )

The pylon viewer has a documentation window. In this window you'll see a piece of C++ code as a sample. The feature names are identical in python.

To your specific request: Learn how auto-exposure enabling/disabling works in pylonviewer or the feature documentation ( select your camera model first in top right corner ) under https://docs.baslerweb.com/exposure-auto.html#c-native_1

Hope this helps as a start.

pauljurczak commented 1 year ago

Thank you. Your answer was very helpful. Here are my sample settings:

cam1.PixelFormat = 'RGB8'
cam1.Gain = 0
cam1.ExposureTime = 2000
cam1.ExposureAuto = 'Off'
cam1.GainAuto = 'Off'
cam1.BslLightSourcePreset = 'Off'
cam1.BalanceWhiteAuto = 'Off'
cam1.BalanceRatioSelector = 'Red'
cam1.BalanceRatio = 1.0
cam1.BalanceRatioSelector = 'Blue'
cam1.BalanceRatio = 1.5
cam1.BalanceRatioSelector = 'Green'
cam1.BalanceRatio = 0.6

Does it turn off all auto functions for my daA3840-45uc cameras?

thiesmoeller commented 1 year ago

First switch the auto modes off .. then set the manual values.. Rest looks good :-)