Easonyesheng / CCS

[RA-L&IROS22] A learning-based camera calibration system.
MIT License
31 stars 2 forks source link

Discrepancy in Camera Intrinsic Parameters Calculation #10

Closed d6753 closed 6 months ago

d6753 commented 6 months ago

Hello, I have encountered an issue while testing your demo_data and comparing the camera intrinsic parameters calculated using your detection network versus OpenCV's detection functions: 'findChessboardCorners' and 'cornerSubPix'. Both were calibrated using cv2.calibrateCamera, the only difference is the method used for corner detection.

The intrinsic parameters calculated with your network appear tis good. But when using OpenCV's functions, the results deviate significantly from the GT intrinsic parameters.

For the data under demo_data/demo_light,

  1. the ground truth is: [[198.09040918 0. 190.06963524] [ 0. 198.09040918 190.06963524] [ 0. 0. 1. ]]
  2. Using your detection network are: [[198.05426328 0. 186.61500565] [ 0. 198.12495409 190.1812139 ] [ 0. 0. 1. ]]
  3. Using OpenCV detection are: [[367.04455669 0. 194.43182841] [ 0. 364.48648065 193.10588978] [ 0. 0. 1. ]]

So why there might be such a big difference in the results? Thank you.

Easonyesheng commented 6 months ago

Hi~ We also observed this phenomenon in our experiments; we believe that this may be due to the instability of cv2.calibrateCamera, which is sensitive to corner detection accuracy. The difference is mainly in the f part, which may reveal a difference in scale. On the other hand, we found the calibration method in Matlab to be more stable and its output was more similar to our results.

d6753 commented 6 months ago

Thank you. I have another question about the threshold_locate function used initially in obtaining corner coordinates from the heatmap (function: get_coor_from_heatmap). If I'm dealing with a smaller image where the corners are relatively dense, for example, with a pixel difference of around 10 pixels between adjacent corners, how can I achieve this? I've tried adjusting the parameters in the threshold_locate function, like changing the cluster_dist value, but it doesn't detect the coordinates. It only works when I increase the ORT value, but the overall calculation results in a significant error. So, do you have any good suggestions for obtaining coordinates from a heatmap with densely packed corners?

Easonyesheng commented 6 months ago

Hi~ In my opinion, there are two methods that may help in the extraction of dense corners.

  1. Try a NMS filter with window size < 10 on the heatmap, which means a new get_coor_from_heatmap function.
  2. Crop the chessboard out from the original image and upscale it, but the detected corner coordinates need to be put back into the original image coordinate system before calibration.
d6753 commented 6 months ago

I tried the first method using NMS, and it worked. Thank you so much!