问题
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