我按照此处github link for aurco library
编制了aruco库我已经检查过它已成功编译,因为我可以在python中导入它而没有任何错误,并检查我是否已经运行了example.py脚本,但是当它写了这段代码
import cv2
import numpy as np
import aruco
Dictionary = aruco.getPredefinedDictionary(aruco.PREDEFINED_DICTIONARY_NAME(DICT_5X5_250=6))
aruco.drawMarker(Dictionary,5,250,markerImage,1)
aruco.drawMarker(Dictionary,10,250,markerImage,1)
aruco.drawMarker(Dictionary,20,250,markerImage,1)
aruco.drawMarker(Dictionary,25,250,markerImage,1)
aruco.drawMarker(Dictionary,50,250,markerImage,1)
aruco.drawMarker(Dictionary,100,250,markerImage,1)
aruco.drawMarker(Dictionary,200,250,markerImage,1)
cv2.imshow("markers",markerImage)
cv2.waitKey(0)
cv2.imgwrite(marker.jpg,markerImage)
它抛出错误
回溯(最近一次呼叫最后一次):文件" drawmarker.py",第7行,在 Dictionary = aruco.getPredefinedDictionary(aruco.PREDEFINED_DICTIONARY_NAME(DICT_5X5_250 = 6)) AttributeError:'模块'对象没有属性 ' getPredefinedDictionary'
有人可以让我知道我做错了什么,这个模块是不是在aruco的python版本中导入的?
答案 0 :(得分:1)
也许你应该试试这个“aruco.DICT_5X5_250”作为参数,比如......
dict = aruco.getPredefinedDictionary( aruco.DICT_5X5_250 )
它对我有用:)