Skip to content

order of board.chessboardCorners != order of aruco.interpolateCornersCharuco #2604

Closed
@edmund3333

Description

@edmund3333
System information (version)
  • OpenCV => opencv-contrib-python 4.3.0.36
  • Operating System / Platform => Win 10
  • Env: Python 3.7
Detailed description

not sure if its a bug, but when calling "aruco.detectMarkers" i get the correct order of markers but after calling "aruco.interpolateCornersCharuco" the order of the chessboard corners has changed and is not consitent with the corner order i get with "board.chessboardCorners".
This is why i cannot call "cv2.findHomography" with the chessboardCorners from "aruco.interpolateCornersCharuco" and "board.chessboardCorners".

In the attached image "charuco.jpg" you can see the blue marker ids and the yellow chessboard ids and that the chessboard ids start on the other side of the charuco board.

I think the chessboard ids should start at the same side as the marker ids and the "board.chessboardCorners" ids.

Steps to reproduce
import cv2
parameters = cv2.aruco.DetectorParameters_create()
#creat board
aruco_dict = cv2.aruco.Dictionary_get(cv2.aruco.DICT_4X4_50)
board = cv2.aruco.CharucoBoard_create(11, 8, 40, 30, aruco_dict)

img = cv2.imread(r'cam1_img1.png')

img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
marker_corners_c, marker_ids, rejectedImgPoints = cv2.aruco.detectMarkers(img_gray, aruco_dict, parameters=parameters)
cv2.aruco.drawDetectedMarkers(img, marker_corners_c, marker_ids)
cv2.aruco.drawDetectedMarkers(img, rejectedImgPoints, borderColor=(100, 0, 240))

[retval, chessboard_corners_c, chessboard_ids_c] = cv2.aruco.interpolateCornersCharuco(marker_corners_c, marker_ids, img_gray, board)

cv2.aruco.drawDetectedCornersCharuco(img,chessboard_corners_c, chessboard_ids_c,  cornerColor=(0, 215, 255))
cv2.imshow('camera_image', img)
cv2.waitKey(0)

#board image
cam1_img1
#board image with markers(blue) and chessboard corners (yellow) (the ids start with 0 at different positions on the board)
charuco

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions