OpenCV-Python Dense SIFT Settings



这是之前发布的关于在python中使用OpenCVs密集sift实现的问题(OpenCV-Python dense SIFT)的后续问题。

使用建议的代码进行密集筛选

    dense=cv2.FeatureDetector_create("Dense")
    kp=dense.detect(imgGray)
    kp,des=sift.compute(imgGray,kp)

我有以下问题:

  • 我可以在python中访问任何DenseFeatureDetector属性吗?设置或至少读取?
  • c++s FeatureDetector::create 成为 pythons FeatureDetector_create背后的逻辑是什么?我如何根据文档 (http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_feature_detectors.html) 知道这一点?
  • 对 VLFeat Library 的 python 包装器有什么建议吗?pyvlfeat 仍然是要走的路吗(我尝试设置 pyvlfeat,但它没有在我的 Mac 上编译)?

谢谢!

您可以通过以下方式查看当前(默认)选项:

dense = cv2.FeatureDetector_create('Dense')
f = '{} ({}): {}'
for param in dense.getParams():
    type_ = dense.paramType(param)
    if type_ == cv2.PARAM_BOOLEAN:
        print f.format(param, 'boolean', dense.getBool(param))
    elif type_ == cv2.PARAM_INT:
        print f.format(param, 'int', dense.getInt(param))
    elif type_ == cv2.PARAM_REAL:
        print f.format(param, 'real', dense.getDouble(param))
    else:
        print param

然后你会得到如下所示的输出:

featureScaleLevels (int): 1
featureScaleMul (real): 0.10000000149
initFeatureScale (real): 1.0
initImgBound (int): 0
initXyStep (int): 6
varyImgBoundWithScale (boolean): False
varyXyStepWithScale (boolean): True

您可以按如下方式更改选项:

dense.setDouble('initFeatureScale', 10)
dense.setInt('initXyStep', 3)

最新更新