Search code examples
c++opencvaruco

OpenCV aruco, Z-axis doesn't draw properly


I have a problem with function drawAxis in aruco module. Z axis flip and general aren't at 90 degrees (X and Y works fine).

The problem is illustrated by the screen: flip axis

I tried changed camera, detect another markers and do many recalibration (i tried different configuration of photos, between 15 and 100)

When I printed vector of rotation (rvec) I noticed that angle 0 and 1 (x, y?) had small fluctuation, but angle 2 (z?) are in general constant: rvec print

Where could be a problem? If X and Y axis work fine, code should be correct? It's normal that rvec_2 is constant? Or maybe t's my fault with calibration?

Please for any clues! Regards!


Solution

  • I found a solution: my mistake was using standard calibration chessboard pattern: bad calibration board

    I know that in many tutorials this calibration works fine, but in my case - no

    My soultion was charuco board (source code for charuco generator): https://github.com/opencv/opencv_contrib/blob/master/modules/aruco/samples/calibrate_camera_charuco.cpp

    When I calibrate my camera using this board everything work fine

    Hope this can be usefull for someone, greetings