Automatic IR power control

Note

This feature is only available on OAK devices with IR lights.

Note

This feature is experimental, please report any issues you encounter to the Luxonis team.

Automatic IR power control is a feature that allows the device to automatically adjust the IR power based on the scene. This is useful for applications where the scene is not always the same, for example when the camera is used in an outdoor environment.

To enable automatic IR power control, you need to use auto_ir method that accepts two parameters:

  • auto_mode - True to enable automatic IR power control, False to disable it.

  • continuous_mode - True to enable continuous mode, False otherwise. Requires auto_mode to be enabled.

When automatic mode is enabled, the device will automatically adjust the IR power after the startup. The disparity map will be analyzed with different dot projector and illumination settings, and once the best settings are found, the device will use them for the rest of the session. The whole process takes around 25 seconds.

If continuous mode is enabled, the device will continue to search for better settings. In case the scene changes and disparity map quality drops below a certain threshold, the device will automatically adjust the IR power again.

Usage

The following example shows how to enable automatic IR power control in continuous mode:

from depthai_sdk import OakCamera

with OakCamera() as oak:
    left = oak.create_camera('left')
    right = oak.create_camera('right')
    stereo = oak.create_stereo(left=left, right=right)

    # Automatically estimate IR brightness and adjust it continuously
    stereo.set_auto_ir(auto_mode=True, continuous_mode=True)

    oak.visualize([stereo.out.disparity, left])
    oak.start(blocking=True)