heethesh / lidar_camera_calibration

Light-weight camera LiDAR calibration package for ROS using OpenCV and PCL (PnP + LM optimization)
BSD 3-Clause "New" or "Revised" License
528 stars 117 forks source link

NaN Values in Translation Vector and Re-projection Error #66

Closed Chandan-kumar-R closed 1 month ago

Chandan-kumar-R commented 1 month ago

I am encountering an issue where my calculations result in NaN values. This occurs during the translation vector calculation, leading to NaN values in the projected 2D points and the re-projection error.

Details:

Loaded points2D:
[[355.23511773 183.771195  ]
 [312.40953854 186.19528439]
 [313.21756834 154.68212234]
 [356.85117732 153.06606275]
 [354.42708794 183.771195  ]]

Loaded points3D:
[[ 4.62300014 -0.278       0.68800002]
 [ 4.6329999   0.17        0.67900002]
 [ 4.63500023  0.16500001  1.05900002]
 [ 4.62699986 -0.336       1.028     ]
 [ 4.61399984 -0.27599999  0.67799997]]

Inliers:
[[0]
 [1]
 [2]
 [3]
 [4]]

Rotation Vector:
[[0.]
 [0.]
 [0.]]

Translation Vector:
[[nan]
 [nan]
 [nan]]

Projected 2D Reprojected Points:
[[nan nan]
 [nan nan]
 [nan nan]
 [nan nan]
 [nan nan]]

Shapes:
projected2d shape: (5, 2)
points2D shape:  (5, 2)
error shape:  (5, 2)

Re-projection Error:
[INFO] [1719580742.484309]: Re-projection error before LM refinement (RMSE) in px: nan
[INFO] [1719580742.485649]: Re-projection error after LM refinement

Calibration result

Euler Angles (RPY):
(0.0, -0.0, 0.0)

Rotation Matrix:
[[1. 0. 0.]
 [0. 1. 0.]
 [0. 0. 1.]]

Translation Offsets:
[[nan nan nan]]

The translation vector results in NaN values, which propagates through the rest of the calculations, leading to NaN values in the projected 2D points and the re-projection error.

I appreciate any guidance or recommendations you can provide to help me progress with task.

Thank you in advance for your assistance!

Chandan-kumar-R commented 1 month ago

Never mind. my camera matrix and dist_coef was empty that's why i was getting nan values.