Ask Your Question

Revision history [back]

FeatureDetector factory doesn't work

I've been trying out the abstract class FeatureDetector, which has a factory method to create several child detectors. Unfortunately, this factory doesn't allow passing any parameters to the constructor, which I suspect many of the detectors need (some of the children have a member called Params). The following code caused an exception:

cv::FeatureDetector * the_detector;

the_detector= FeatureDetector::create("FAST");
vector<KeyPoint> keypoints;

the_detector->detect(img, keypoints);

However, identical handling of an automatic variable constructed with the default constructor worked just fine:

cv::FeatureDetector * the_detector;

cv::FastFeatureDetector FFD;
    // the_detector= FeatureDetector::create("FAST");
the_detector = &FFD;
vector<KeyPoint> keypoints;

the_detector->detect(img, keypoints);

I don't know what the create() method is doing, but it doesn't seem to be much good.