multical icon indicating copy to clipboard operation
multical copied to clipboard

KeyError: 'num_points'

Open shreychowdhary opened this issue 2 years ago • 2 comments

Hi, when running my calibration, I getting the following output and error. Does this mean that my calibration images aren't good enough or is there something more?

INFO - Using boards:
INFO - charuco_8x10 CharucoBoard {type='charuco', aruco_dict='4X4_1000', aruco_offset=0, size=(8, 10), num_ids=40, marker_length=0.00325, square_length=0.004, aruco_params={}}
INFO - Found camera directories ['cam1', 'cam2', 'cam4'] with 55 matching images
INFO - Loading images..
100%|█████████████████████████████████████████████████████████████████████████████████| 165/165 [00:00<00:00, 1299.79it/s]
INFO - Loaded 165 images
INFO - {'cam1': (664, 510), 'cam2': (728, 544), 'cam4': (720, 540)}
INFO - Detecting boards..
100%|██████████████████████████████████████████████████████████████████████████████████| 165/165 [00:00<00:00, 707.23it/s]
INFO - Writing detection cache to ./calibration.detections.pkl
INFO - Detected point counts:
INFO - Total: 1455, cameras: {'cam1': 459, 'cam2': 560, 'cam4': 436}, Boards: {'charuco_8x10': 1455}
INFO - Calibrating single cameras..
INFO - Calibrated cam1, with RMS=0.38
INFO - Camera {'dist': array([[-0.1682,  1.0735,  0.0128, -0.007 ,  0.0496]]),
        'image_size': (664, 510),
        'intrinsic': array([[1178.1721,    0.    ,  310.0039],
              [   0.    , 1169.6104,  292.7193],
              [   0.    ,    0.    ,    1.    ]])}
INFO -
INFO - Calibrated cam2, with RMS=0.34
INFO - Camera {'dist': array([[-0.5028,  5.7458,  0.0125,  0.0042, -1.0467]]),
        'image_size': (728, 544),
        'intrinsic': array([[1709.053 ,    0.    ,  355.7551],
              [   0.    , 1688.38  ,  231.7347],
              [   0.    ,    0.    ,    1.    ]])}
INFO -
INFO - Calibrated cam4, with RMS=0.35
INFO - Camera {'dist': array([[  0.0941, -10.6645,   0.002 ,   0.0032, 131.8718]]),
        'image_size': (720, 540),
        'intrinsic': array([[1154.8022,    0.    ,  360.2282],
              [   0.    , 1150.0286,  249.2311],
              [   0.    ,    0.    ,    1.    ]])}
INFO -
INFO - Pose counts:
INFO - Total: 35, cameras: {'cam1': 10, 'cam2': 14, 'cam4': 11}, Boards: {'charuco_8x10': 35}
INFO - Overlaps by camera:
INFO - [[  0.  23.  49.]
        [ 23.   0. 105.]
        [ 49. 105.   0.]]
INFO - Selected master 2 and pairs [(2, 1), (2, 0)]
INFO - Estimate transform axis=0, pair (2, 1), inliers 4/4
INFO - RMS (frobius): 0.0212 (0.0212) (deg): 0.8584 (0.8584) (trans): 0.0039 (0.0039)
INFO - [[ 0.8263  0.2279  0.5151 -0.0936]
        [-0.0982  0.9588 -0.2667  0.0498]
        [-0.5546  0.1698  0.8146  0.1328]
        [ 0.      0.      0.      1.    ]]
INFO - Estimate transform axis=0, pair (2, 0), inliers 2/2
INFO - RMS (frobius): 0.0056 (0.0056) (deg): 0.2253 (0.2253) (trans): 0.0006 (0.0006)
INFO - [[ 0.688   0.3996  0.6058 -0.0898]
        [-0.6566  0.6984  0.285  -0.0503]
        [-0.3092 -0.5938  0.7429  0.063 ]
        [ 0.      0.      0.      1.    ]]
INFO - Overlaps by board:
INFO - [[0.]]
INFO - Selected master 0 and pairs []
/home/labuser/.local/lib/python3.8/site-packages/scipy/cluster/vq.py:136: RuntimeWarning: Some columns have standard deviation zero. The values of these columns will not change.
  warnings.warn("Some columns have standard deviation zero. "
Traceback (most recent call last):
  File "/home/labuser/.local/bin/multical", line 8, in <module>
    sys.exit(cli())
  File "/home/labuser/.local/lib/python3.8/site-packages/multical/app/multical.py", line 28, in cli
    run_with(Multical)
  File "/home/labuser/.local/lib/python3.8/site-packages/multical/config/arguments.py", line 73, in run_with
    return program.app.execute()
  File "/home/labuser/.local/lib/python3.8/site-packages/multical/app/multical.py", line 24, in execute
    return self.command.execute()
  File "/home/labuser/.local/lib/python3.8/site-packages/multical/app/calibrate.py", line 21, in execute
    calibrate(self)
  File "/home/labuser/.local/lib/python3.8/site-packages/multical/app/calibrate.py", line 37, in calibrate
    initialise_with_images(ws, boards, camera_images, args.camera, args.runtime)
  File "/home/labuser/.local/lib/python3.8/site-packages/multical/config/workspace.py", line 37, in initialise_with_images
    ws.initialise_poses(
  File "/home/labuser/.local/lib/python3.8/site-packages/multical/workspace.py", line 201, in initialise_poses
    pose_init = tables.initialise_poses(self.pose_table,
  File "/home/labuser/.local/lib/python3.8/site-packages/multical/tables.py", line 367, in initialise_poses
    times = relative_between_n(expanded, board_relative, axis=1, inv=True)
  File "/home/labuser/.local/lib/python3.8/site-packages/multical/tables.py", line 336, in relative_between_n
    return Table.stack(relative_poses)
  File "/home/labuser/.local/lib/python3.8/site-packages/structs/numpy.py", line 48, in stack
    return Table.from_structs(structs)
  File "/home/labuser/.local/lib/python3.8/site-packages/structs/numpy.py", line 31, in from_structs
    struct_lists = transpose_structs(structs)
  File "/home/labuser/.local/lib/python3.8/site-packages/structs/struct.py", line 398, in transpose_structs
    d = {key: [d[key] for d in structs] for key in elem.keys()}
  File "/home/labuser/.local/lib/python3.8/site-packages/structs/struct.py", line 398, in <dictcomp>
    d = {key: [d[key] for d in structs] for key in elem.keys()}
  File "/home/labuser/.local/lib/python3.8/site-packages/structs/struct.py", line 398, in <listcomp>
    d = {key: [d[key] for d in structs] for key in elem.keys()}
  File "/home/labuser/.local/lib/python3.8/site-packages/structs/struct.py", line 78, in __getitem__
    return self._entries[index]
KeyError: 'num_points'

shreychowdhary avatar Oct 28 '22 22:10 shreychowdhary

No that looks like a bug - can you tell me what version of 'structs' is installed as well as the version of multical? Is it off github or pip?

oliver-batchelor avatar Nov 02 '22 11:11 oliver-batchelor

No that looks like a bug - can you tell me what version of 'structs' is installed as well as the version of multical? Is it off github or pip?

It was off pip using version 0.2.2. I don't have access to that computer at the moment, so I don't know what version of structs was installed. I was able to stop hitting the error. The first image I had in the calibration folders didn't include the calibration markers. Once I removed those images and only had images that had calibration markers in them, the calibration started working.

shreychowdhary avatar Nov 09 '22 23:11 shreychowdhary