我正在嘗試檢測此影像中的 ArUco 標記:
使用此代碼:
import cv2
import cv2.aruco as aruco
import numpy as np
def findArucoMarkers(img, markerSize = 5, totalMarkers=250, draw=True):
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
key = getattr(aruco, f'DICT_{markerSize}X{markerSize}_{totalMarkers}')
arucoDict = aruco.Dictionary_get(key)
arucoParam = aruco.DetectorParameters_create()
bboxs, ids, rejected = aruco.detectMarkers(gray, arucoDict, parameters = arucoParam)
print(ids)
if draw:
aruco.drawDetectedMarkers(img, bboxs)
return [bboxs, ids]
path = ""
imName= "test3.png"
img = cv2.imread(path imName)
arucofound = findArucoMarkers(img, markerSize = 5)
cv2.imshow('img',img)
cv2.waitKey(0)
可悲的是,沒有檢測到標記!你能告訴我如何正確檢測標記嗎?提前致謝。
編輯:
標記是從這個網站在線生成的5x5,ID:0, 2, 4, 12, 17
使用的相機Asus Xtion Live Pro。
uj5u.com熱心網友回復:
圖片是標記的鏡像。
ArUco 標記在鏡像時不會被解碼。
防止/撤消鏡像。找到執行此操作的設備/驅動程式設定。
flipped = cv.flip(img, 1)圍繞 Y 軸翻轉影像。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/424706.html
