Hi I have the oak-D lite fixed focus and auto-focus cameras. The z-coordinate provided by the camera for specific objects on the conveyor are not very accurate, the conveyor is around 900mm from the camera. The camera shows random heights from 800 to 1200mm even when I hold the objects close around 500mm. Is there any calibration or setting that needs to be done before the camera can start giving accurate pixel depth estimates? The range of depth of objects on the conveyor could be between 830 to 900mm.

    5 days later

    I have checked the article - <https://docs.luxonis.com/projects/api/en/latest/tutorials/configuring-stereo-depth/#improving-depth-accuracy ](https://docs.luxonis.com/projects/api/en/latest/tutorials/configuring-stereo-depth/#improving-depth-accuracy)

    I want to try and setDisparityShift to see if my accuracy improves, since my conveyor is at 800mm and there wont be objects below that depth. Can you provide any examples of DisparityShift being set?

    AttributeError: 'depthai.node.StereoDepth' object has no attribute 'setDisparityShift'
    AttributeError: module 'depthai' has no attribute 'stereoDepthConfig'

    I tried setting using stereo and stereoDepthConfig, but it shows no attribute, maybe I'm using it wrong.

    This is my current CAM setup for oak-d lite

    pipeline = dai.Pipeline()
    
    # Define source and output
    camRgb = pipeline.create(dai.node.ColorCamera)
    xoutVideo = pipeline.create(dai.node.XLinkOut)
    
    xoutVideo.setStreamName("video")
    
    
    
    # Properties
    #Preview settings
    camRgb.setPreviewSize(640, 480)
    camRgb.setInterleaved(False)
    camRgb.setColorOrder(dai.ColorCameraProperties.ColorOrder.RGB)
    #camRgb.initialControl.setManualFocus(180) # 0..255
    camRgb.initialControl.setManualFocus(24)
    controlIn = pipeline.create(dai.node.XLinkIn)
    controlIn.setStreamName('control')
    
    # camRgb.preview.link(xoutVideo.input)
    #Preview settings
    # camRgb.setBoardSocket(dai.CameraBoardSocket.CAM_A)
    camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
    # camRgb.setVideoSize(1920, 1080)
    
    xoutVideo.input.setBlocking(False)
    xoutVideo.input.setQueueSize(1)
    
    # Linking
    camRgb.video.link(xoutVideo.input)
    
    # Stereo depth setup
    monoLeft = pipeline.create(dai.node.MonoCamera)
    monoRight = pipeline.create(dai.node.MonoCamera)
    stereo = pipeline.create(dai.node.StereoDepth)
    # Properties
    monoLeft.setResolution(dai.MonoCameraProperties.SensorResolution.THE_480_P)
    monoLeft.setBoardSocket(dai.CameraBoardSocket.LEFT)
    monoRight.setResolution(dai.MonoCameraProperties.SensorResolution.THE_480_P)
    monoRight.setBoardSocket(dai.CameraBoardSocket.RIGHT)
    
    stereo.initialConfig.setConfidenceThreshold(55)
    stereo.setLeftRightCheck(True)
    stereo.setSubpixel(False)
    #Stereospatial new additions
    stereo.setDefaultProfilePreset(dai.node.StereoDepth.PresetMode.HIGH_DENSITY)
    stereo.setDepthAlign(dai.CameraBoardSocket.CAM_A)
    stereo.setOutputSize(monoLeft.getResolutionWidth(), monoLeft.getResolutionHeight())
    # stereo.setDisparityShift(10)
    # dai.stereoDepthConfig.setDisparityShift(20)
    #Stereospatial new additions
    
    # Linking
    monoLeft.out.link(stereo.left)
    monoRight.out.link(stereo.right)
    
    xoutDepth = pipeline.create(dai.node.XLinkOut)
    xoutDepth.setStreamName("depth")
    stereo.depth.link(xoutDepth.input)
    
    xoutDepth = pipeline.create(dai.node.XLinkOut)
    xoutDepth.setStreamName("disp")
    stereo.disparity.link(xoutDepth.input)
    xoutDepth.input.setBlocking(False)
    xoutDepth.input.setQueueSize(1)
    # Stereo depth setup
    # Depth Exposure and ISO Sensitivity control
    ctrl = dai.CameraControl()
    expTime = 18500
    sensIso = 600

    Currently the accuracy of depth is truly random, its giving me 950mm for object placed right in front of the camera. around 100 mm to 400 mm

    How do I set disparity shift in this setup?

      Hi DARYLTHOMAS
      Use stereo.initialConfig.setDisparityShift(20). Keep in mind that if your object moves to close to the camera (eg. 10cm) and is visible only on one of the mono cameras, the depth will obviously not work since disparity cannot be calculated.

      Thanks,
      Jaka

      14 days later

      Were you able to get the exposure time set and record a video? I am having trouble doing this.

      • erik replied to this.