title: Setting ORB parameters in OpenCv with Python
body: <p>I've been using OpenCV 2.4 in Python to match features between two images, but I want to change one of the parameters of the "ORB" detector (the number of features it extracts "nfeatures") and there seems to be no way to do so in Python.</p>
  
  <p>For C++ you can load a parameter yml/xml file by the 'read' (or 'load' for java?) methods of FeatureDetector/DescriptorExtractor. However the Python binding is missing this function/method.</p>
  
  <p>It's also missing the binding to create an ORB object directly, so I can't pass the parameters there (Python binding seems to requires you to use cv2.DescriptorExtractor_create by string name -- which will segfault if you pass a bad string name or the parameters along with it... Additionally that function cannot take any other arguments it seems to pass onto the constructor.</p>
  
  <p>My only hope seemed to be loading the complete object from xml with cv2.cv.Load(filename), but that seems to expect an object instance and not an Algorithm definition, for which I can't find any Python bindings in new or old syntax. I tried several variations on the file loading step, including mimicking the style of saved xml files from OpenCV with no luck.</p>
  
  <p>Has anyone has success in one of the steps I tried above to pass parameters onto a detector (SURF or ORB, or any generic algorithm) in OpenCV?</p>
  
  <p>Here is the code I am using to extract features:</p>
  
  <pre><code>def findFeatures(greyimg, detector="ORB", descriptor="ORB"):
      nfeatures = 2000 # No way to pass to detector...?
      detector = cv2.FeatureDetector_create(detector)
      descriptorExtractor = cv2.DescriptorExtractor_create(descriptor)
      keypoints = detector.detect(greyimg)
      (keypoints, descriptors) = descriptorExtractor.compute(greyimg, keypoints)
      return keypoints, descriptors
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Changing detector settings seems to only segfault on windows implementation -- waiting for a patch or fix to appear on OpenCV's site.</p>