OpenCV-Python Dense SIFT Settings

大兔子大兔子 提交于 2019-12-24 01:14:29

问题


This is a follow-up question to the previously posted question about using OpenCVs dense sift implementation in python (OpenCV-Python dense SIFT).

Using the suggested code for a dense sift

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

I have the following questions:

  • Can I access any of the DenseFeatureDetector properties in python? Set or at least read?
  • What is the logic behind c++s FeatureDetector::create becoming pythons FeatureDetector_create? How can I know that based on the documentation (http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_feature_detectors.html)?
  • Any recommendation on a python wrapper for VLFeat Library? Is pyvlfeat still the way to go (I tried to setup pyvlfeat but it didn't compile on my mac)?

Thanks!


回答1:


You can see current (default) options with the following:

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

Then you'd get an output like the following:

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

You can alter the options as the following:

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


来源:https://stackoverflow.com/questions/29970191/opencv-python-dense-sift-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!