Skip to content

运行时发生了一些错误 #1

@lsj1111

Description

@lsj1111

当我执行检测Aruco码的函数时:函数如下
def Aruco_detect(gray):
aruco_dict = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_4X4_50)
myByteList = []
for idx, code in enumerate(aruco_dict.bytesList):
code = code[np.newaxis, :, :]
bits = cv2.aruco.Dictionary_getBitsFromByteList(code, 4)
bits = cv2.flip(bits, 1)
code = cv2.aruco.Dictionary_getByteListFromBits(bits)
myByteList.append(code[0])
myByteList = np.stack(myByteList, axis=0)
dict1 = cv2.aruco.Dictionary(myByteList, 4)
parameters = cv2.aruco.DetectorParameters()
result = {}
cv2.imshow('image', gray)
cv2.waitKey(0)
corners, ids, _ = cv2.aruco.detectMarkers(gray, dict1, parameters=parameters)
#assert (len(corners)!=0), print("Please retest")
if len(corners) == 0:
print("Please retest")
raise AssertionError

if ids is not None:
    corners_1 = np.array(corners).reshape(-1, 4, 2)
    center_points = np.mean(corners_1, 1)
for i, idx in enumerate(ids):
    idx = int(idx)
    result[idx] = center_points[i]
return result

报错提示:Traceback (most recent call last):
File "test.py", line 96, in
martrix = matching_test(args.gray_folder, args.ph_coordinate, parameters, pro_size, cam_size)
File "test.py", line 54, in matching_test
anchors = Aruco_detect(images_list[45])
File "test.py", line 29, in Aruco_detect
raise AssertionError
AssertionError
Please retest

据我现在对代码的理解,似乎并没有创建Aruco码

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions