Hi,

I'm trying to use the following code (with an OAK-1), but still got no success on canceling the frequency banding on the image. Any ideas on the problem? Thanks!

import cv2
import depthai as dai

pipeline = dai.Pipeline()

camRgb = pipeline.create(dai.node.ColorCamera)

controlIn = pipeline.create(dai.node.XLinkIn)
controlIn.setStreamName('control')

xoutVideo = pipeline.create(dai.node.XLinkOut)
xoutVideo.setStreamName("video")

camRgb.setBoardSocket(dai.CameraBoardSocket.RGB)
camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_4_K)

xoutVideo.input.setBlocking(False)
xoutVideo.input.setQueueSize(1)

camRgb.video.link(xoutVideo.input)
controlIn.out.link(camRgb.inputControl)

frameWidth, frameHeight = camRgb.getResolutionWidth(), camRgb.getResolutionHeight()
w = int(frameWidth / 5)
h = int(frameHeight / 5)

with dai.Device(pipeline) as device:

    video = device.getOutputQueue(name="video", maxSize=1, blocking=False)
    controlQueue = device.getInputQueue('control')

    while True:
        ctrl = dai.CameraControl()
        ctrl.setManualFocus(115)
        ctrl.setManualExposure(3000, 500)
        ctrl.setAntiBandingMode(dai.CameraControl.AntiBandingMode.MAINS_60_HZ)
        controlQueue.send(ctrl)
        videoIn = video.get()
        frame = videoIn.getCvFrame()
        frame = cv2.resize(frame, (w, h))            
        cv2.imshow("video", frame)

        if cv2.waitKey(1) == ord('q'):
            break

    Hi jvitordm

    I see the exposure is manually set to 3000us, in this case anti-banding won't help, as it is based on setting the exposure to multiples of half the mains frequency. So for 60Hz, should be set in multiples of 16667us / 2 = 8333us.
    Try increasing the exposure to this value and reduce the ISO. Let us know if this helps.

      Great! And I didn't mentioned above that anti-banding/anti-flicker is supposed to work with auto-exposure. But in very bright environments, the exposure may get below the half the mains period frequency, and then will be no longer effective. The AE process basically sets the exposure like below for 60Hz:

      fine-grained if < 8.333ms, 8.333ms, 16.667ms, 25ms, ...