我正在尝试校准笔记本电脑相机以检测aruco标记,并最终能够估计与标记的距离。我一直在使用here中提供的教程。
我已经解决了运行此代码时遇到的一些问题,但在实际尝试校准相机时遇到了麻烦。
if calibrate_camera == True:
img_list = []
i = 0
while i < numberOfImages:
name = "C:/Users/Cory/aruco_data/" + str(i) + ".jpg"
img = cv2.imread(name)
img_list.append(img)
h, w, c = img.shape
i += 1
counter = []
corners_list = []
id_list = []
first = True
for im in img_list:
img_gray = cv2.cvtColor(im,cv2.COLOR_RGB2GRAY)
corners, ids, rejectedImgPoints = aruco.detectMarkers(img_gray, aruco_dict, parameters=arucoParams)
if first == True:
corners_list = corners
print(type(corners))
id_list.append(ids)
first = False
else:
corners_list = np.vstack((corners_list, corners))
id_list = np.vstack((id_list,ids))
counter.append(ids)
(len(counter))
counter = np.array(counter)
print ("Calibrating camera .... Please wait...")
mat = np.zeros((3,3), float)
ret, mtx, dist, rvecs, tvecs = aruco.calibrateCameraAruco(corners_list, id_list, counter, board, img_gray.shape, None, None )
“ TypeError:不支持ids数据类型= 17”
运行代码的最后一行时,将显示上述错误。 我很困惑如何解决此问题并继续进行其余代码