Ask Your Question

Charuco Camera Calibration from video - console always close immediatly, why?

asked 2017-12-06 09:08:37 -0500

sarah1802 gravatar image

Hi Together,

I am tryinig the last days to implement the Aruco-Markers with OpenCV and VisualStudio 2017 C++. First I calibrate my camera with the normal checkerboard from OpenCV. Due to a flipping Z-Axis I want to calibrate my camera with the Charuco board. I am an absolute beginner at programming and using all these fancy things like libaries and so on for the first time.

I used the example of the of the "opencv_contrib-master\modules\aruco\samples\calibrate_camera_charuco.cpp". This are my options for the calibration:

    const char* keys =
    "{w        |     5  | Number of squares in X direction }"
    "{h        |     7  | Number of squares in Y direction }"
    "{sl       |   0,03465    | Square side length (in meters) }"
    "{ml       |   0,02086   | Marker side length (in meters) }"
    "{d        |    16   | dictionary: DICT_4X4_50=0, DICT_4X4_100=1, DICT_4X4_250=2,"
    "DICT_4X4_1000=3, DICT_5X5_50=4, DICT_5X5_100=5, DICT_5X5_250=6, DICT_5X5_1000=7, "
    "DICT_6X6_50=8, DICT_6X6_100=9, DICT_6X6_250=10, DICT_6X6_1000=11, DICT_7X7_50=12,"
    "DICT_7X7_100=13, DICT_7X7_250=14, DICT_7X7_1000=15, DICT_ARUCO_ORIGINAL = 16}"
    "{@outfile |<none> | Output file with calibrated camera parameters }"
    "{v        |  VideoCharucoBoard.MOV     | Input from video file, if ommited, input comes from camera }"
    "{ci       |    | Camera id if input doesnt come from video (-v) }"
    "{dp       | charucoBoardKalibrierungsdaten.txt     | File of marker detector parameters }"
    "{rs       | false | Apply refind strategy }"
    "{zt       | false | Assume zero tangential distortion }"
    "{a        |       | Fix aspect ratio (fx/fy) to this value }"
    "{pc       | false | Fix the principal point at the center }"
    "{sc       | true | Show detected chessboard corners after calibration }";

I have my Video "VideoCharucoBoard.MOV" in the project folder. It compile with no errors or warnings, but the console only opens for a few milliseconds. I also added the "opencv_ffmpeg331_64.dll" to the project folder and added the include paths and linker (also needed for the aruco detection, which works by the way with no problems...).

Thank you for your help :-) Sarah

Can anybody help me on this problem?

edit retag flag offensive close merge delete


have no fear, this is a typical noob problem, you're probably starting your program from the ide, and thus there are no cmdline args supplied, and it returns here

open a cmd exe in your project folder (or where the exe is, and run it from there. you should see the same help msg as above.

in the meantime, let us find out, which of the ~20 params there are the (minimal) required 7 ;)

berak gravatar imageberak ( 2017-12-06 09:29:08 -0500 )edit

if you prefer to edit the cmdline params in your program, you still have to comment out this part

berak gravatar imageberak ( 2017-12-06 10:18:56 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-12-06 09:47:17 -0500

berak gravatar image

again, run this from a cmdline (cmd.exe), and supply proper input params . you also need to copy the detector_params.yml to your folder

the tutorial has:

calibrate_camera_charuco -dp="detector_params.yml" -w=5 -h=7 -sl=0.04 -ml=0.02 -d=10 output.txt

(output.txt will have your calibration output)

good luck !

edit flag offensive delete link more


Ok, now it works. With the console it always told me: "Not enough captures for calibration" and does not open the video at all. With the ide I am able to open the video and capture the frames but if I want to save them it calculate something but close with no .txt file in the folder :(.

Edit: I have done the whole thing via ide and it worked. I only forgot to delete the <> from the output-file-name. I used the parameters directly in my code.

sarah1802 gravatar imagesarah1802 ( 2017-12-11 06:05:09 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-12-06 09:08:37 -0500

Seen: 85 times

Last updated: Dec 06 '17