rameau-fr / MC-Calib

A generic and robust calibration toolbox for multi-camera systems
MIT License
412 stars 61 forks source link

`board_index ` issue #91

Open 5shekel opened 6 hours ago

5shekel commented 6 hours ago

System information (version)

Vision system

using sample dataset and accompanying calib_param_Seq02_Overlapping_multicamera.yml

Describe the issue / bug

repeated crashes running the calib_param_Seq02_Overlapping_multicamera sample. i tried using windows wsl docker , then moved to a linux machine but had the same issue.

0000001 | 2024-11-17, 19:57:55.819609 [info] - Nb of cameras : 2   Nb of Boards : 1   Refined Corners : true   Distortion mode : 0
0000002 | 2024-11-17, 19:57:55.819859 [info] - Extraction camera 001
0000003 | 2024-11-17, 19:57:55.832931 [info] - Number of threads for board detection :: 96
0000034 | 2024-11-17, 19:57:58.305439 [info] - Extraction camera 002
0000035 | 2024-11-17, 19:57:58.318093 [info] - Number of threads for board detection :: 96
0000066 | 2024-11-17, 19:57:59.797331 [info] - Board extraction done!
0000067 | 2024-11-17, 19:57:59.797378 [info] - Intrinsic calibration initiated
0000068 | 2024-11-17, 19:57:59.797390 [info] - Initializing camera calibration using images
0000069 | 2024-11-17, 19:57:59.797408 [info] - NB of board available in this camera :: 0
0000070 | 2024-11-17, 19:57:59.797417 [info] - NB of frames where this camera saw a board :: 0
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.10.0) /home/opencv-4.10.0/modules/calib3d/src/calibration.cpp:3859: error: (-215:Assertion failed) nimages > 0 in function 'calibrateCameraRO'

(core dumped)

i found that if i change the board_index from the set [12] to [1,2,3,4,5,6,7,8,9,10,11,12,13] the calibration passed.

here are the changes i made to the yaml

 length_marker: 0.03  # parameters on the marker (can be kept as it is)
 number_board: 1 # number of boards used for calibration (for overlapping camera 1 is enough ...)
-boards_index: [12] #leave it empty [] if the board index are ranging from zero to number_board
+boards_index: [1,2,3,4,5,6,7,8,9,10,11,12,13]
# example of usage boards_index: [5,10] <-- only two board with index 5/10
square_size: 9.15  # size of each square of the board in cm/mm/whatever you want                                                                                                                                                                

############# Boards Parameters for different board size (leave empty if all boards have the same size) ###############
number_x_square_per_board: []
number_y_square_per_board: []
square_size_per_board: []                                                                                                                           

@@ -21,7 +19,7 @@
 distortion_model: 0 #0:Brown (perspective) // 1: Kannala (fisheye)
 distortion_per_camera : [] #specify the model per camera,
 #leave "distortion_per_camera" empty [] if they all follow the same model (make sure that the vector is as long as cameras nb)
-number_camera: 6  # number of cameras in the rig to calibrate
+number_camera: 2  # number of cameras in the rig to calibrate
 refine_corner: 1  # activate or deactivate the corner refinement
 min_perc_pts: 0.5  # min percentage of points visible to assume a good detection
+save_detection: 1
+save_reprojection: 1

for brevity
only ran it one 2 of the cameras, and after keeping on only 30 image from the two cameras., but it replicates for me on full dataset.

in the successful run detected_keypoints_data.yml i see this

board_idxs: [ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
       12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 ]

the failed attempts crashed before the detection

the problem i hope is simple user error. as far i understand the board_index is a vector that maps the board to different board sizes, which i haven't change. then why is it set to 12 in that sample?

~~i am planning to print and use the demo boards, mybe all six in a cube, what indexes should i use? ~~
https://github.com/rameau-fr/MC-Calib/issues/50 similar

and lastly, thank you for the project!

5shekel commented 5 hours ago

here a link to the adapted sample i used with only 30 frames for each camera.