[Python] Segmentation Error when Creating Charuco Board with Custom Ids

Discussão em 'Python' iniciado por Stack, Agosto 4, 2025.

  1. Stack

    Stack Membro Participativo

    My intention is to create a charuco board object, which supports custom ids. Here is the code snippet being used.

    def __init__(self, squaresX=11, squaresY=8, squareLength=0.015, markerLength=0.011,
    dict=cv2.aruco.DICT_5X5_250, start_id=0):

    self.squaresX = squaresX
    self.squaresY = squaresY
    self.squareLength = squareLength
    self.markerLength = markerLength

    self.aruco_dict = cv2.aruco.getPredefinedDictionary(dict)
    self.start_id = start_id

    num_markers_x = squaresX - 1
    num_markers_y = squaresY - 1
    num_markers = num_markers_x * num_markers_y

    if start_id + num_markers > self.aruco_dict.bytesList.shape[0]:
    raise ValueError(f"Not enough markers in dictionary for board (required: {num_markers})")

    marker_ids = np.arange(start_id, start_id + num_markers, dtype=np.int32).reshape(num_markers_y, num_markers_x)

    self.board = cv2.aruco.CharucoBoard(
    (self.squaresX, self.squaresY),
    self.squareLength,
    self.markerLength,
    self.aruco_dict,
    marker_ids
    )


    However when I create self.board, there is a segmentation error (keep in mind when I'm creating the object, I'm using the same arguments as the default arguments to the __init__ method.

    cv2.__version__ returns 4.11.0

    Continue reading...

Compartilhe esta Página