gpt4 book ai didi

python-3.x - CV2 ORB 参数

转载 作者:行者123 更新时间:2023-12-04 02:13:31 26 4
gpt4 key购买 nike

我已经实现了 cv2 orb 检测器和蛮力匹配器。两者都在处理大图像。

但是,当我将图像裁剪到我感兴趣的区域并再次运行时,找不到任何特征。

我想调整参数,但我无法访问我的 orb 描述符的变量,这只是一个引用

ORB: >ORB00000297D3FD3EF0\<



我还尝试了 cpp 文档,但没有任何结果。我想知道描述符默认使用哪些参数,然后使用交叉验证来调整它们。

先感谢您
"ORB Features"
def getORB(img):
#Initiate ORB detector
orb = cv2.ORB_create()

#find keypoints
kp = orb.detect(img)

#compute despriptor
kp, des = orb.compute(img,kp)
# draw only keypoints location,not size and orientation
img2 = cv2.drawKeypoints(img, kp, None, color=(0,255,0), flags=0)
plt.imshow(img2), plt.show()
return kp,des

最佳答案

你应该使用 python 的 dir(...) 检查不透明对象的功能 -
它返回属于该对象的方法列表:

>>> dir(orb)
['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', ...]

提示:过滤所有以下划线开头的方法(私有(private)方法的约定)
>>> [item for item in dir(orb) if not item.startswith('_')]
['compute', 'create', 'defaultNorm', 'descriptorSize', 'descriptorType',
'detect', 'detectAndCompute', 'empty', 'getDefaultName', 'getEdgeThreshold',
'getFastThreshold', 'getFirstLevel', 'getMaxFeatures', 'getNLevels', ...]

这揭示了您将需要的所有 getter 和 setter。这是一个示例设置 - MaxFeatures范围:
>>> kp = orb.detect(frame)

>>> len(kp)
1000

>>> orb.getMaxFeatures
<built-in method getMaxFeatures of cv2.ORB object at 0x1115d5d90>

>>> orb.getMaxFeatures()
1000

>>> orb.setMaxFeatures(200)

>>> kp = orb.detect(frame)

>>> len(kp)
200

关于python-3.x - CV2 ORB 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48008362/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com