-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Closed
Labels
Description
System information (version)
OpenCV => opencv-contrib-python 4.3.0.36
Operating System / Platform => Win 10
Env: Python 3.7
Detailed description
if you use CharucoBoard_create and plot the internal markerpositions of the charucoboard the positions are wrong if the charuco board has an even row count.
Steps to reproduce
import cv2
import numpy as np
squaresX = 11
#squaresY = 7
squaresY = 8
parameters = cv2.aruco.DetectorParameters_create()
# create board
aruco_dict = cv2.aruco.Dictionary_get(cv2.aruco.DICT_4X4_50)
board = cv2.aruco.CharucoBoard_create(squaresX, squaresY, 40, 30, aruco_dict)
img_board = board.draw((40*squaresX, 40*squaresY), marginSize=0, borderBits=1)
cs_corners_o = np.array([np.array([[a[0], a[1]]]) for a in board.chessboardCorners])
cs_corner_ids = np.array([[a] for a in np.arange(cs_corners_o.shape[0])])
img_board_color = cv2.cvtColor(img_board, cv2.COLOR_GRAY2BGR)
# remove third dimension from points
objPoints = []
for marker in board.objPoints:
newPoint = np.array([[[a[0], a[1]] for a in marker]])
objPoints.append(newPoint)
cv2.aruco.drawDetectedMarkers(img_board_color, objPoints, board.ids)
cv2.imshow('data from: CharucoBoard_create', img_board_color)
# plot detected data from image
img_board_color2 = cv2.cvtColor(img_board, cv2.COLOR_GRAY2BGR)
img_bord_gray = cv2.cvtColor(img_board_color2, cv2.COLOR_BGR2GRAY)
marker_corners_c, marker_ids, rejectedImgPoints = cv2.aruco.detectMarkers(img_bord_gray, aruco_dict, parameters=parameters)
cv2.aruco.drawDetectedMarkers(img_board_color2, marker_corners_c, marker_ids)
cv2.imshow('data from: drawDetectedMarkers', img_board_color2)
cv2.waitKey(0)
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues,
answers.opencv.org, Stack Overflow, etc and have not found solution - I updated to latest OpenCV version and the issue is still there
- There is reproducer code and related data files: videos, images, onnx, etc