Inconsistent orientation of detected/generated ArUco and AprilTags
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- opencv, python
- Domain
- computer-vision
Research direction
Start with the provided Python reproduction using ArucoDetector.detectMarkers and generateImageMarker for the AprilTag and ArUco dictionaries. Trace how each dictionary defines corner ordering and generated marker orientation; done means detection and generation use a consistent orientation for both marker families, with the reproduction confirming the corrected ordering.
Written by the indexing model from the issue text.
Description
ArUco and AprilTag detection both uses a clockwise orientation, however, AprilTag corners start with bottom right while ArUco starts with upper left. See the example below:
Code:
import cv2
def draw_markers_with_corners(img, corners):
for i, marker_corners in enumerate(corners):
# Get the corners of the marker
corner_points = marker_corners.reshape((4, 2))
corner_points = corner_points.astype(int)
# Draw each corner with its ordinal position
for j, corner in enumerate(corner_points):
# Draw corner point
cv2.circle(img, tuple(corner), 5, (0, 0, 255), -1)
# Label the corner with its ordinal position (0, 1, 2, 3)
cv2.putText(
img,
str(j),
(corner[0] + 10, corner[1] + 10),
cv2.FONT_HERSHEY_SIMPLEX,
0.5,
(255, 0, 0),
2,
)
return img
img = cv2.imread("markers.jpeg")
parameters = cv2.aruco.DetectorParameters()
april_dict = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_APRILTAG_36h11)
april_detector = cv2.aruco.ArucoDetector(april_dict, parameters)
aruco_dict = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_4X4_250)
aruco_detector = cv2.aruco.ArucoDetector(aruco_dict, parameters)
img_marked = img.copy()
april_corners, _, _ = april_detector.detectMarkers(img)
img_marked = draw_markers_with_corners(img_marked, april_corners)
aruco_corners, _, _ = aruco_detector.detectMarkers(img)
img_marked = draw_markers_with_corners(img_marked, aruco_corners)
cv2.imwrite("markers_detected.jpeg", img_marked)
The same issue persists (likely due to pre-defined dictionary configurations) for generation:
The generated AprilTag 36h11 - 0 (wrong orientation, see above)
The generated ArUco 4x4_250 - 0 (correct orientation, see above)
Code:
import cv2
april_dict = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_APRILTAG_36h11)
aruco_dict = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_4X4_250)
img = cv2.aruco.generateImageMarker(aruco_dict, 0, 200, borderBits=1)
cv2.imwrite("aruco.png", img)
img = cv2.aruco.generateImageMarker(april_dict, 0, 200, borderBits=1)
cv2.imwrite("april.png", img)
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 1k
- Avg merge
- 22h 17m
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from opencv/opencv-python
-
[DOC] README file Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
opencv/opencv-python#1217 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
opencv/opencv-python#1165 · 2 comments · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
opencv/opencv-python#1273 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
opencv/opencv-python#1272 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 70/100
opencv/opencv-python#1268 · 1 comment ·
All issues in opencv/opencv-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anthropics/skills#1811 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
speaches-ai/speaches#678 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
datalayer/mcp-compose#42 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
conda-forge/spacy-feedstock#177 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
UKGovernmentBEIS/inspect_evals#2523 ·