src/matching2D_Student.cpp
// Use one of several types of state-of-art descriptors to uniquely identify keypoints
Use one of several types of state-of-art descriptors to uniquely identify keypoints
Use one of several types of state - of - art descriptors to uniquely identify keypoints
void descKeypoints(vector<cv::KeyPoint> &keypoints, cv::Mat &img, cv::Mat &descriptors, string descriptorType) {
    cv::Ptr<cv::DescriptorExtractor> extractor;
    if (descriptorType.compare("BRISK") == 0) {
        int threshold = 30;        
        int octaves = 3;           
        float patternScale = 1.0f; 
        extractor = cv::BRISK::create(threshold, octaves, patternScale);
    } else if (descriptorType.compare("BRIEF") == 0) extractor = cv::xfeatures2d::BriefDescriptorExtractor::create();
    else if (descriptorType.compare("ORB") == 0) extractor = cv::ORB::create();
    else if (descriptorType.compare("FREAK") == 0) extractor = cv::xfeatures2d::FREAK::create();
    else if (descriptorType.compare("AKAZE") == 0) extractor = cv::AKAZE::create();
    else if (descriptorType.compare("SIFT") == 0) extractor = cv::xfeatures2d::SIFT::create();
    else throw invalid_argument("Unknown descriptorType" + descriptorType);
    double t = (double) cv::getTickCount();
    extractor->compute(img, keypoints, descriptors);
    t = ((double) cv::getTickCount() - t) / cv::getTickFrequency();
}
void descKeypoints ( vector < cv :: KeyPoint > & keypoints , cv :: Mat & img , cv :: Mat & descriptors , string descriptorType ) { cv :: Ptr < cv :: DescriptorExtractor > extractor ; if ( descriptorType . compare ( " " ) == 0 ) { int threshold = 30 ; int octaves = 3 ; float patternScale = 1.0f ; extractor = cv :: BRISK :: create ( threshold , octaves , patternScale ) ; } else if ( descriptorType . compare ( " " ) == 0 ) extractor = cv :: xfeatures2d :: BriefDescriptorExtractor :: create ( ) ; else if ( descriptorType . compare ( " " ) == 0 ) extractor = cv :: ORB :: create ( ) ; else if ( descriptorType . compare ( " " ) == 0 ) extractor = cv :: xfeatures2d :: FREAK :: create ( ) ; else if ( descriptorType . compare ( " " ) == 0 ) extractor = cv :: AKAZE :: create ( ) ; else if ( descriptorType . compare ( " " ) == 0 ) extractor = cv :: xfeatures2d :: SIFT :: create ( ) ; else throw invalid_argument ( " " + descriptorType ) ; double t = ( double ) cv :: getTickCount ( ) ; extractor -> compute ( img , keypoints , descriptors ) ; t = ( ( double ) cv :: getTickCount ( ) - t ) / cv :: getTickFrequency ( ) ; }
Use one of several types of state-of-art descriptors to uniquely identify keypoints
Use one of several types of state - of - art descriptors to uniquely identify keypoints
// select appropriate descriptor // FAST/AGAST detection threshold score. // detection octaves (use 0 to do single scale) // apply this scale to the pattern used for sampling the neighbourhood of a keypoint. // perform feature description //    cout << descriptorType << " descriptor extraction in " << 1000 * t / 1.0 << " ms" << endl;