Here is the command we use: python calibrate.py -s 2.45 -brd OAK-D-LITE -db
We eventually got t finish the calibration process, but at the end with an Eipolar number. The screen showed red background image with text "EEprom Write Failed!! 0.144 Try recalibrating!! We tried a few more times for calibration but the same outcome showing EEprom Write error.

  • erik replied to this.

    JamesYeh could you share the images that you took while calibrating? I believe they are written in /dataset folder. I would assume images for calibration weren't taken ideally which results in bad epipolar error and failed calibration.
    Thanks, Erik

    JamesYeh

    Can you share a clear image of the calibration board? Just want to see if it has any defects. Also, can you double-check the square and marker size?

    Here are 3 up-to-date scanned images and cardboard image. I tried many times and it still showed EEprom Write failed message. I'm wondering if this is due to hardware setting issues instead of calibration procedure. I used the command in the following for OAK_D Lite and the square size is 2.45 cm. Thanks!
    python calibrate.py -s 2.45 -brd OAK-D-LITE -db



      JamesYeh

      Might be the quality of the calibration board (as you glued it to the carton board, some dents may have formed, it's also very glossy), can you try to calibrate using a monitor to show the Calib board? Or to print a better board?

      @JamesYeh what version of depthai you have installed? Do you have other depthai devices, and if so, do you see the same calibration error for them?

      It's the latest version we downloaded from your website recently.

        JamesYeh in the depthai/resources/ there should be export of the calibration file called <your_cam_mxid.json>. Can you find it and share it with us?

        Is this one?

        {
        "board_config":
        {
        "name": "OAK-D-LITE",
        "revision": "R0M0E0",
        "left_fov_deg": 72.9,
        "rgb_fov_deg": 68.7938,
        "left_to_right_distance_cm": 7.5,
        "left_to_rgb_distance_cm": 3.75
        }
        }

        Or this one?

        {
            "batchName": "",
            "batchTime": 0,
            "boardConf": "",
            "boardCustom": "",
            "boardName": "OAK-D-LITE",
            "boardOptions": 0,
            "boardRev": "R0M0E0",
            "cameraData": [
                [
                    1,
                    {
                        "cameraType": 0,
                        "distortionCoeff": [
                            72.98009490966797,
                            522.8361206054688,
                            0.002551776124164462,
                            -0.0023029004223644733,
                            -295.53253173828125,
                            73.34515380859375,
                            515.9074096679688,
                            -263.6693115234375,
                            0.0,
                            0.0,
                            0.0,
                            0.0,
                            0.0,
                            0.0
                        ],
                        "extrinsics": {
                            "rotationMatrix": [
                                [
                                    0.999978244304657,
                                    -0.004396865144371986,
                                    -0.004916712641716003
                                ],
                                [
                                    0.004408243577927351,
                                    0.9999876022338867,
                                    0.002305838745087385
                                ],
                                [
                                    0.004906513262540102,
                                    -0.0023274626582860947,
                                    0.9999852776527405
                                ]
                            ],
                            "specTranslation": {
                                "x": -7.5,
                                "y": 0.0,
                                "z": 0.0
                            },
                            "toCameraSocket": 2,
                            "translation": {
                                "x": -7.507689476013184,
                                "y": -0.0775049552321434,
                                "z": -0.2214062213897705
                            }
                        },
                        "height": 480,
                        "intrinsicMatrix": [
                            [
                                457.5869140625,
                                0.0,
                                326.1402282714844
                            ],
                            [
                                0.0,
                                458.2024841308594,
                                228.6510009765625
                            ],
                            [
                                0.0,
                                0.0,
                                1.0
                            ]
                        ],
                        "lensPosition": 0,
                        "specHfovDeg": 72.9000015258789,
                        "width": 640
                    }
                ],
                [
                    2,
                    {
                        "cameraType": 0,
                        "distortionCoeff": [
                            17.46405601501465,
                            -150.1464385986328,
                            -0.0016553334426134825,
                            0.00011951004853472114,
                            273.1391906738281,
                            17.549184799194336,
                            -150.72332763671875,
                            274.1268005371094,
                            0.0,
                            0.0,
                            0.0,
                            0.0,
                            0.0,
                            0.0
                        ],
                        "extrinsics": {
                            "rotationMatrix": [
                                [
                                    0.9999249577522278,
                                    0.008298547938466072,
                                    -0.009012527763843536
                                ],
                                [
                                    -0.008360672742128372,
                                    0.9999414086341858,
                                    -0.00687749870121479
                                ],
                                [
                                    0.008954926393926144,
                                    0.006952333729714155,
                                    0.9999357461929321
                                ]
                            ],
                            "specTranslation": {
                                "x": 3.75,
                                "y": 0.0,
                                "z": 0.0
                            },
                            "toCameraSocket": 0,
                            "translation": {
                                "x": 3.6784276962280273,
                                "y": -0.0021816904190927744,
                                "z": -0.033592239022254944
                            }
                        },
                        "height": 480,
                        "intrinsicMatrix": [
                            [
                                453.6978454589844,
                                0.0,
                                305.2757873535156
                            ],
                            [
                                0.0,
                                454.0751037597656,
                                235.96502685546875
                            ],
                            [
                                0.0,
                                0.0,
                                1.0
                            ]
                        ],
                        "lensPosition": 0,
                        "specHfovDeg": 72.9000015258789,
                        "width": 640
                    }
                ],
                [
                    0,
                    {
                        "cameraType": 0,
                        "distortionCoeff": [
                            75.20023345947266,
                            -32.183929443359375,
                            0.00032048311550170183,
                            0.0047751059755682945,
                            243.44769287109375,
                            75.53861999511719,
                            -41.4549560546875,
                            256.639404296875,
                            0.0,
                            0.0,
                            0.0,
                            0.0,
                            0.0,
                            0.0
                        ],
                        "extrinsics": {
                            "rotationMatrix": [],
                            "specTranslation": {
                                "x": 0.0,
                                "y": 0.0,
                                "z": 0.0
                            },
                            "toCameraSocket": -1,
                            "translation": {
                                "x": 0.0,
                                "y": 0.0,
                                "z": 0.0
                            }
                        },
                        "height": 1080,
                        "intrinsicMatrix": [
                            [
                                1493.9559326171875,
                                0.0,
                                1033.2745361328125
                            ],
                            [
                                0.0,
                                1490.411865234375,
                                514.8790893554688
                            ],
                            [
                                0.0,
                                0.0,
                                1.0
                            ]
                        ],
                        "lensPosition": 135,
                        "specHfovDeg": 68.7938003540039,
                        "width": 1920
                    }
                ]
            ],
            "hardwareConf": "",
            "imuExtrinsics": {
                "rotationMatrix": [],
                "specTranslation": {
                    "x": 0.0,
                    "y": 0.0,
                    "z": 0.0
                },
                "toCameraSocket": -1,
                "translation": {
                    "x": 0.0,
                    "y": 0.0,
                    "z": 0.0
                }
            },
            "miscellaneousData": [],
            "productName": "",
            "stereoRectificationData": {
                "leftCameraSocket": 1,
                "rectifiedRotationLeft": [
                    [
                        0.9996805787086487,
                        0.005854921415448189,
                        0.02458525262773037
                    ],
                    [
                        -0.005882907193154097,
                        0.9999821186065674,
                        0.0010661549167707562
                    ],
                    [
                        -0.02457856945693493,
                        -0.0012104471679776907,
                        0.9996971487998962
                    ]
                ],
                "rectifiedRotationRight": [
                    [
                        0.9995121955871582,
                        0.010318374261260033,
                        0.029476208612322807
                    ],
                    [
                        -0.010284807533025742,
                        0.9999462962150574,
                        -0.0012901463778689504
                    ],
                    [
                        -0.029487937688827515,
                        0.000986359897069633,
                        0.9995646476745605
                    ]
                ],
                "rightCameraSocket": 2
            },
            "version": 7
        }

          JamesYeh Thank you, the second one is the right one. The first one is the initial config needed to start calibration, the second one is the full config generated by the calibration.
          We are working on that. I will get back to you as soon as we resolve it.

          What do you mean by branch? USB 3.2 or Thunderbolt 4 port? We tried both. We also tried with and without your Y adapter.

            JamesYeh open terminal, navigate to depthai folder and type git branch, you should see similar output to the one on the picture. The row with * is the branch name we are looking for

            This is what I saw... Lite_calibration.

            @"JamesYeh" I would like you to try one little experiment.
            in your depthai/ folder, locate the calibrate.py file. open it with any text editor or an IDE like Pycharm.
            On lines 611-614
            you can locate this code:

            if self.args.factoryCalibration:
                self.device.flashFactoryCalibration(calibration_handler)
            is_write_succesful = self.device.flashCalibration(calibration_handler)

            change it to

            if self.args.factoryCalibration:
                self.device.flashFactoryCalibration(calibration_handler)
            is_write_succesful = self.device.flashCalibration2(calibration_handler)

            The change is int the self.device.flashCalibration2

            It can happen that this code piece is not on above mentioned lines, it depends on the depthai branch. Either way yor calibrate.py file should contain those lines so you can find them.

            When it is done, run the calibration again, the same way as before. Now, it should end with en Error printed out in the terminal. Send us the error please.

            Here are the codes at the end of the calibrate.py

            resImage = None
            if not self.device.isClosed():
            dev_info = self.device.getDeviceInfo()
            mx_serial_id = dev_info.getMxId()
            calib_dest_path = dest_path + '/' + mx_serial_id + '.json'
            calibration_handler.eepromToJsonFile(calib_dest_path)
            is_write_succesful = False


                        try:
                            is_write_succesful = self.device.flashCalibration(
                                calibration_handler)
                        except:
                            print("Writing in except...")
                            is_write_succesful = self.device.flashCalibration(
                                calibration_handler)
                        if is_write_succesful:
                            resImage = create_blank(900, 512, rgb_color=green)
                            text = "Calibration Succesful with"
                            cv2.putText(resImage, text, (10, 250),
                                        font, 2, (0, 0, 0), 2)
                            text = "Epipolar error of " + str(epiploar_error)
                            cv2.putText(resImage, text, (10, 300),
                                        font, 2, (0, 0, 0), 2)
                        else:
                            resImage = create_blank(900, 512, rgb_color=red)
                            text = "EEprom Write Failed!! " + str(epiploar_error)
                            cv2.putText(resImage, text, (10, 250),
                                        font, 2, (0, 0, 0), 2)
                            text = "Try recalibrating !!"
                            cv2.putText(resImage, text, (10, 300),
                                        font, 2, (0, 0, 0), 2)
                    else:
                        calib_dest_path = dest_path + '/depthai_calib.json'
                        # calibration_handler.eepromToJsonFile(calib_dest_path)
                        resImage = create_blank(900, 512, rgb_color=red)
                        text = "Calibratin succesful. " + str(epiploar_error)
                        cv2.putText(resImage, text, (10, 250), font, 2, (0, 0, 0), 2)
                        # text = "Device not found to write to EEPROM"
                        # cv2.putText(resImage, text, (10, 300), font, 2, (0, 0, 0), 2)
            
                    if resImage is not None:
                        cv2.imshow("Result Image", resImage)
                        cv2.waitKey(0)
                except AssertionError as e:
                    print("[ERROR] " + str(e))
                    raise SystemExit(1)
            
            def run(self):
                if 'capture' in self.args.mode:
                    try:
                        if Path('dataset').exists():
                            shutil.rmtree('dataset/')
                        Path("dataset/left").mkdir(parents=True, exist_ok=True)
                        Path("dataset/right").mkdir(parents=True, exist_ok=True)
                        if not self.args.disableRgb:
                            Path("dataset/rgb").mkdir(parents=True, exist_ok=True)
                    except OSError:
                        traceback.print_exc()
                        print("An error occurred trying to create image dataset directories!")
                        raise SystemExit(1)
                    self.show_info_frame()
                    self.capture_images()
                self.dataset_path = str(Path("dataset").absolute())
                if 'process' in self.args.mode:
                    self.calibrate()
                print('py: DONE.')

            if name == "main":
            Main().run()

            JamesYeh in the branch lite_calibration that you are using it is in
            depthai/calibrate.py
            in there, lines 570-576 change them from:

            try:
                is_write_succesful = self.device.flashCalibration(calibration_handler)
            except:
                print("Writing in except...")
                is_write_succesful = self.device.flashCalibration(calibration_handler)

            to

            self.device.flashCalibration2(calibration_handler)

            so it will now look like this:

            ...
            ...
            calib_dest_path = dest_path + '/' + mx_serial_id + '.json'
            calibration_handler.eepromToJsonFile(calib_dest_path)
            is_write_succesful = False
            
            is_write_succesful = self.device.flashCalibration2(calibration_handler)
            if is_write_succesful:
                resImage = create_blank(900, 512, rgb_color=green)
                ...
                ...
                ...

            and run calibration again, you should get an Error, send it to us