My measurements with the OAK-D Pro out of the box have been off anywhere from 1-8cm. and I'd like to try calibrating the camera to see if it improves the depth accuracy. I can't find documentation on how to use the calibrate.py script at luxonis/depthaiblob/main/calibrate.py

I see there is a youtube video here for it but the instructions are unclear

How is this script meant to be used?

  • JakeMarquez
    Oh, that's to be expected. The Z gives you shortest path from object plane to camera plane - looking at Z when pointing camera at a flat perpendicular surface (pointing at a wall), all points on the wall should have the same depth Z.

    You want euclidean distance which is -- sqrt(x^2 + y^2 + z^2)

    Thanks
    Jaka

@JakeMarquez what's unclear about the script? Are you interested in any specifics?

@erik just general expected usage. I did not know what a charuco board is, but I found this online generator for one but I have no way of knowing they are all the same or there is a specific configuration required https://calibrate.deepen.ai/target-generator

Additionally, the script comment by the args says the board should be printed and fixed to a flat surface yet the video shows it being done with a computer screen. When I try with my computer screen it does not recognize the squares.

Are the square size measurements to be taken on the physical monitor? I measured the squares on my monitor at 2.9cm for this. What distance is the camera supposed to be from the monitor? What angle?

Some general guidance would be apreciated, thanks

@erik Awesome! That's what I was looking for. I went through the calibration steps and for the most part the depth information seems to be more accurate now, however I noticed the depth isnt as accurate when the subject is not centered. For example, If I have a book that I move horizontally along a counter, the depth reading is fairly accurate when it is straight ahead of the camera and gets less and less accurate as it goes on.

Diagram here shows what I measure with a tape from the camera to the book itself.

The actual results from the depthai_viewer are

Expected: 75cm -- Measured: 72.8

Expected 75.5 -- Measured: 72.8

Expected 77.5 -- Measured: 74.2

Expected 81 -- Measured: 74.6

I have tried with various objects and distances, and experimented with the speckle filter and it seems simlarly to lose accuracy if not centered. Is this a result of improper calibration or has this issue been resolved before?

    Hi JakeMarquez
    It's very likely this is an undistortion issue which stems from a bad calibration. Are you reading raw depth values or are you performing any calculations on top? Can you show a disparity image of a flat surface. It should be radially symmetric in that case.

    Thanks,
    Jaka

    @jakaskerl using gen2-calc-spatials-on-host example I took this disparity image, also BW photo for reference

    71cm was the expected distance from the camera to the wall. Additionally I took these photos with a box in front of the wall, just moving the ROI from center to edge of box expecting distance to increase:

    Photo A -- Expected: 66cm, Actual: 66cm

    Photo B -- Expected 71cm, Actual 66cm

    There is definitely distortion, is this amount unexpected, or due to calibration issues? -- Thanks

      JakeMarquez
      Oh, that's to be expected. The Z gives you shortest path from object plane to camera plane - looking at Z when pointing camera at a flat perpendicular surface (pointing at a wall), all points on the wall should have the same depth Z.

      You want euclidean distance which is -- sqrt(x^2 + y^2 + z^2)

      Thanks
      Jaka