Ask Your Question

matt.leotta's profile - activity

2015-07-08 04:11:27 -0600 received badge  Student (source)
2015-07-07 20:11:40 -0600 received badge  Editor (source)
2015-07-07 20:09:53 -0600 commented answer How do I select Algorithms at runtime?

This is not an ideal solution. It requires me to hard code conditional statements for every algorithm and then similarly for every parameter of every algorithm. It gets even uglier when some of the algorithms are only available if opencv_contrib is available. And algorithms may be added or parameters changed in future 3.0.x releases, which will required me to maintain all of these options, possibly with #ifdefs to support different OpenCV versions.

OpenCV 2.4 handled all of this nicely by allowing me to probe at run time (not compile time) which algorithms were available and what the parameters are available and of what type.

2015-07-07 15:40:02 -0600 asked a question How do I select Algorithms at runtime?

In OpenCV 2.4 I could construct and configure Algorithms from the base class. If I knew I had a FeatureDetector, my code didn't need to know what kind of feature detector it was. I could use the create() member function with a string name like "SIFT" or "ORB" to construct an algorithm based on a string specified in a config file. I could similarly set algorithm parameters from the base class. Can I do something similar in OpenCV 3.0?

From what I can tell, in OpenCV 3.0 I need to explicitly construct the algorithm with its constructor and can only set parameters in the constructor, or in some cases by reading from a config file (which most algorithms don't yet support), or in some cases by member functions on the derived class (which most algorithms don't provide yet). Is this correct? Are there any plans for future OpenCV releases to bring back construction of algorithms from a string name and setting algorithm parameters without needing to know which algorithm it is?

For some context, I'm writing an open source application built on OpenCV that uses FeatureDetectors, DescriptorExtractors, DescriptorMatchers, etc. in an abstract way. This should compile across a range of OpenCV versions and build configurations (e.g. with or without contrib). At run time I'd like to allow the user to select and configure any detector, descriptor, and matcher that their build of OpenCV happens to support. OpenCV 2.4 had a nice solution for this. Although it was buggy, I miss it.

I suppose my questions are more roadmap questions.

  1. Are algorithms factories ever coming back in OpenCV 3.x?
  2. Is a general parameter configuration API ever coming back?