Hi everyone,

I'm currently calibrating an OAK-D camera and I'm encountering some issues. The error I'm facing is as follows:

RuntimeError: No PROTECTED permissions to override protected EEPROM field

Could anyone help me with this?

    abned
    You are trying to overwrite protected fields in the calibration file, (board_name, config,..). Create calibration handler in a way that none of those are present.
    Basically only flash the calibration with the intrinsics/extrinsics, not the whole calibration.

    Similar to: https://docs.luxonis.com/projects/api/en/latest/samples/calibration/calibration_flash/ which doesn't alter any of the protected fields.

    Thanks,
    Jaka

      jakaskerl Thank you so much for your help. Your advice was incredibly useful, and I was able to resolve the problem thanks to your guidance.

      I really appreciate your assistance!

      Best regards,

      Andy

      a year later

      Hi Bob,

      Even with that method, if your calibration file includes protected fields like board_name or camera_config, it will still fail. Make sure you're only flashing intrinsics/extrinsics using CalibrationHandler, not a full calibration dump.

      Hope that helps!

      thank you, abned, Here is my JSON file and calibration_flash.py. I have removed some protected fields, but this error still occurs.

      from pathlib import Path
      import depthai as dai
      import argparse

      # 指定设备IP地址
      DEVICE_IP = "192.168.1.27" # 修改为你的实际IP地址

      calibJsonFile = str((Path(file).parent / Path('./calib_19443010C1F46F1300.json')).resolve().absolute())
      calibBackUpFile = str((Path(file).parent / Path('37_27_depthai_calib_backup.json')).resolve().absolute())

      parser = argparse.ArgumentParser()
      parser.add_argument('calibJsonFile', nargs='?', help="Path to calibration file in json", default=calibJsonFile)
      parser.add_argument('--device-ip', type=str, help="POE device IP address", default=DEVICE_IP)
      args = parser.parse_args()

      # 创建设备信息对象
      device_info = dai.DeviceInfo(args.device_ip)

      print(f"Connecting to POE device at IP: {args.device_ip}")

      # Connect device
      with dai.Device(device_info) as device:
      print(f"Connected to device: {device.getMxId()}")

      deviceCalib = device.readCalibration()
      deviceCalib.eepromToJsonFile(calibBackUpFile)
      print("Calibration Data on the device is backed up at:")
      print(calibBackUpFile)
      calibData = dai.CalibrationHandler(args.calibJsonFile)
      
      try:
          device.flashCalibration2(calibData)
          print('Successfully flashed calibration')
      except Exception as ex:
          print(f'Failed flashing calibration: {ex}')

      {

      "cameraData": [
          [
              0,
              {
                  "cameraType": 0,
                  "distortionCoeff": [
                      -7.706638813018799,
                      -65.49735260009766,
                      0\.0004515267792157829,
                      -0.0017077206866815686,
                      586\.9937133789063,
                      -7.948877811431885,
                      -61.568973541259766,
                      569\.932861328125,
                      0\.0,
                      0\.0,
                      0\.0,
                      0\.0,
                      0\.0,
                      0\.0
                  ],
                  "extrinsics": {
                      "rotationMatrix": [
                          [
                              0\.0,
                              0\.0,
                              0\.0
                          ],
                          [
                              0\.0,
                              0\.0,
                              0\.0
                          ],
                          [
                              0\.0,
                              0\.0,
                              0\.0
                          ]
                      ],
                      "specTranslation": {
                          "x": 0.0,
                          "y": 0.0,
                          "z": 0.0
                      },
                      "toCameraSocket": -1,
                      "translation": {
                          "x": 0.0,
                          "y": 0.0,
                          "z": 0.0
                      }
                  },
                  "height": 2160,
                  "intrinsicMatrix": [
                      [
                          3110\.7177734375,
                          0\.0,
                          1935\.41357421875
                      ],
                      [
                          0\.0,
                          3094\.648193359375,
                          1075\.3648681640625
                      ],
                      [
                          0\.0,
                          0\.0,
                          1\.0
                      ]
                  ],
                  "lensPosition": 135,
                  "specHfovDeg": 66.0,
                  "width": 3840
              }
          ],
          [
              2,
              {
                  "cameraType": 0,
                  "distortionCoeff": [
                      -6.873172283172607,
                      42\.98529815673828,
                      0\.00029738646117039025,
                      -0.0010493953013792634,
                      -67.70903778076172,
                      -6.986750602722168,
                      43\.53566360473633,
                      -68.42249298095703,
                      0\.0,
                      0\.0,
                      0\.0,
                      0\.0,
                      0\.0,
                      0\.0
                  ],
                  "extrinsics": {
                      "rotationMatrix": [
                          [
                              0\.9999866485595703,
                              0\.0025550478603690863,
                              0\.004485604353249073
                          ],
                          [
                              -0.002582455752417445,
                              0\.9999779462814331,
                              0\.006115058436989784
                          ],
                          [
                              -0.004469881299883127,
                              -0.006126560736447573,
                              0\.9999712705612183
                          ]
                      ],
                      "specTranslation": {
                          "x": 3.75,
                          "y": 0.0,
                          "z": 0.0
                      },
                      "toCameraSocket": 0,
                      "translation": {
                          "x": 3.8024158477783203,
                          "y": 0.04035785421729088,
                          "z": -0.3319750130176544
                      }
                  },
                  "height": 800,
                  "intrinsicMatrix": [
                      [
                          805\.3842163085938,
                          0\.0,
                          647\.2789306640625
                      ],
                      [
                          0\.0,
                          801\.0499267578125,
                          406\.65997314453125
                      ],
                      [
                          0\.0,
                          0\.0,
                          1\.0
                      ]
                  ],
                  "lensPosition": 0,
                  "specHfovDeg": 80.0,
                  "width": 1280
              }
          ],
          [
              1,
              {
                  "cameraType": 0,
                  "distortionCoeff": [
                      -9.186577796936035,
                      58\.40314483642578,
                      0\.0017220255685970187,
                      -0.0008167429477907717,
                      -89.93488311767578,
                      -9.273968696594238,
                      58\.78185272216797,
                      -90.42240142822266,
                      0\.0,
                      0\.0,
                      0\.0,
                      0\.0,
                      0\.0,
                      0\.0
                  ],
                  "extrinsics": {
                      "rotationMatrix": [
                          [
                              0\.9999059438705444,
                              -0.003832641988992691,
                              -0.013170160353183746
                          ],
                          [
                              0\.0038300310261547565,
                              0\.9999926686286926,
                              -0.000223459632252343
                          ],
                          [
                              0\.013170919381082058,
                              0\.0001729964860714972,
                              0\.999913215637207
                          ]
                      ],
                      "specTranslation": {
                          "x": -7.5,
                          "y": 0.0,
                          "z": 0.0
                      },
                      "toCameraSocket": 2,
                      "translation": {
                          "x": -7.489696502685547,
                          "y": 0.02329738810658455,
                          "z": -0.03992269188165665
                      }
                  },
                  "height": 800,
                  "intrinsicMatrix": [
                      [
                          801\.14892578125,
                          0\.0,
                          645\.86083984375
                      ],
                      [
                          0\.0,
                          796\.9806518554688,
                          420\.7577209472656
                      ],
                      [
                          0\.0,
                          0\.0,
                          1\.0
                      ]
                  ],
                  "lensPosition": 0,
                  "specHfovDeg": 80.0,
                  "width": 1280
              }
          ]
      ],
      "deviceName": "",
      
      "housingExtrinsics": {
          "rotationMatrix": [],
          "specTranslation": {
              "x": 0.0,
              "y": 0.0,
              "z": 0.0
          },
          "toCameraSocket": -1,
          "translation": {
              "x": 0.0,
              "y": 0.0,
              "z": 0.0
          }
      },
      "imuExtrinsics": {
          "rotationMatrix": [
              [
                  0\.0,
                  0\.0,
                  0\.0
              ],
              [
                  0\.0,
                  0\.0,
                  0\.0
              ],
              [
                  0\.0,
                  0\.0,
                  0\.0
              ]
          ],
          "specTranslation": {
              "x": 0.0,
              "y": 0.0,
              "z": 0.0
          },
          "toCameraSocket": -1,
          "translation": {
              "x": 0.0,
              "y": 0.0,
              "z": 0.0
          }
      },
      "miscellaneousData": [],
      "stereoEnableDistortionCorrection": true,
      "stereoRectificationData": {
          "leftCameraSocket": 1,
          "rectifiedRotationLeft": [
              [
                  0\.9999451637268066,
                  -0.0069421567022800446,
                  -0.007839430123567581
              ],
              [
                  0\.006941258907318115,
                  0\.9999759197235107,
                  -0.00014167424524202943
              ],
              [
                  0\.007840224541723728,
                  8\.725096267880872e-05,
                  0\.9999692440032959
              ]
          ],
          "rectifiedRotationRight": [
              [
                  0\.9999809861183167,
                  -0.0031105326488614082,
                  0\.00533024687319994
              ],
              [
                  0\.0031099223997443914,
                  0\.9999951720237732,
                  0\.00012275311746634543
              ],
              [
                  -0.005330602638423443,
                  -0.0001061741349985823,
                  0\.9999858140945435
              ]
          ],
          "rightCameraSocket": 2
      },
      "stereoUseSpecTranslation": false,
      "version": 7,
      "verticalCameraSocket": -1

      }