Cv2.aruco.detectMarkers not detect markers in python

My camera calibration matrices and distortion matrices derived from aruco_calibration_fromimages.exe :

 [[3.19439125e+03   0.00000000e+00   1.98509417e+03]  
  [0.00000000e+00   3.20213561e+03   1.55099552e+03]  
  [0.00000000e+00   0.00000000e+00   1.00000000e+00]]

 [[0.1395281  -0.38313647  0.00505558  0.00237535  0.33952515]]

Image where I am trying to detect:

enter image description here

aruco_simple.exe successfully

enter image description here

But python code does not find anything:

fs = cv2.FileStorage("./calib_asus_chess/cam_calib_asus.yml", cv2.FILE_STORAGE_READ)
cam_mat=fs.getNode("camera_matrix").mat()
dist_mat=fs.getNode("distortion_coefficients").mat()
gray=cv2.imread('C:\\Users\\steve\\Dropbox\\Projects\\kinnekt\\laser\\aruco_frames\\shot1.jpg',0)
adict = cv2.aruco.Dictionary_get(cv2.aruco.DICT_ARUCO_ORIGINAL)
res = cv2.aruco.detectMarkers(gray,dictionary=adict,cameraMatrix=cam_mat,distCoeff=dist_mat)

res [0] is for some reason an empty array. Why is python version not working? Thanx!

+6
source share
1 answer

You are probably using a dictionary that does not match your image. According to cv2.aruco.DICT_ARUCO_ORIGINAL - 5x5 documentation :

DICT_ARUCO_ORIGINAL: ArUco. 1024 , 5x5 , 0

6x6 5x5, .

drawMarker() , .

, DICT_4X4_50. , DICT_4X4_50 DICT_ARUCO_ORIGINAL

+3

All Articles