我已经实现了OpenCV球体探测器和蛮力匹配器。两人都在处理大型图像。
但是,当我将图像裁剪到感兴趣的区域并再次运行时,没有发现任何功能。
我想调整参数,但是我不能访问我的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发布于 2019-09-09 06:59:55
您应该使用python的dir(...)函数来检查不透明对象--它返回属于该对象的方法列表:
>>> dir(orb)
['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', ...]提示:筛选所有以下划线开头的方法(私有方法的约定)
>>> [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)
200https://stackoverflow.com/questions/48008362
复制相似问题