c++ - Retrieve feature type from OpenCV FeatureDetector -


In OpenCV, it is very common to name a cv :: FeatureDetector feature :

  cv :: Ptr   

This is a factory pattern, cv :: FeatureDetector is an abstract class.

Then, given a variable type of cv :: Ptr , is it possible to retrieve the feature name? This is "SURF" in my example. class = "post-text" itemprop = "text">

cv :: algorithm one name () gets the method which gives the algorithm name in the string. In the case of your surf detector, named () returns

Feature2D.SURF

which is a human-readable form In general, this string is algorithm-type . Example-Name , although there is only one-word description in many things, for any feature detection algorithm, the algorithm-type prefix always Feature2D < / code>. If you need an exact string match, you can parse it manually.

  Auto Surf = CV :: Feature Detector :: Create ("Surf"); Auto en = surf-> Name (); Std :: cout & lt; & Lt; N & lt; & Lt; Std :: endl; // print "Feature 2D.SURF", without quote    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -