OpenCV aruco, Z-axis doesn't draw properly

2.5k views Asked by At

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!

2

There are 2 answers

0
Fidor On BEST ANSWER

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

0
Majid Anjidani On

I realize that it is natural and not a bug! In fact Z axis always point toward us and not flipped (You can check the axes generated). What happened is shown in picture bellow because of low resolution or far distance. In fact you see the XY plane the same and think that Z axis flipped in this scenario.

see this for more detail https://github.com/opencv/opencv/issues/8813

enter image description here