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
double 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("FREAK") == 0)
    {
        extractor = cv::xfeatures2d::FREAK::create();
    }
    else if (descriptorType.compare("SIFT") == 0)
    {
        extractor = cv::SiftDescriptorExtractor::create();
    }
    else if (descriptorType.compare("ORB") == 0)
    {
        extractor = cv::ORB::create();
    }
    else if (descriptorType.compare("AKAZE") == 0)
    {
        extractor = cv::AKAZE::create();
    }
    else if (descriptorType.compare("BRIEF") == 0)
    {
        extractor = cv::xfeatures2d::BriefDescriptorExtractor::create();
    }
    else
    {
    }
    double t = (double)cv::getTickCount();
    extractor->compute(img, keypoints, descriptors);
    t = ((double)cv::getTickCount() - t) / cv::getTickFrequency();
    cout << descriptorType << " descriptor extraction in " << 1000 * t / 1.0 << " ms" << endl;
    return 1000 * t / 1.0;
}
double 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 :: FREAK :: create ( ) ; } else if ( descriptorType . compare ( " " ) == 0 ) { extractor = cv :: SiftDescriptorExtractor :: create ( ) ; } else if ( descriptorType . compare ( " " ) == 0 ) { extractor = cv :: ORB :: create ( ) ; } else if ( descriptorType . compare ( " " ) == 0 ) { extractor = cv :: AKAZE :: create ( ) ; } else if ( descriptorType . compare ( " " ) == 0 ) { extractor = cv :: xfeatures2d :: BriefDescriptorExtractor :: create ( ) ; } else { } double t = ( double ) cv :: getTickCount ( ) ; extractor -> compute ( img , keypoints , descriptors ) ; t = ( ( double ) cv :: getTickCount ( ) - t ) / cv :: getTickFrequency ( ) ; cout << descriptorType << " " << 1000 * t / 1.0 << " " << endl ; return 1000 * t / 1.0 ; }
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. /* bool orientationNormalized = true;
        bool scaleNormalized = true;
        float patternScale = 22.0f;
        int nOctaves = 4; */ //extractor = cv::xfeatures2d::FREAK::create(orientationNormalized, scaleNormalized, patternScale, nOctaves); /* int nfeatures = 0;
        int nOctaveLayers = 3;
        double contrastThreshold = 0.04;
        double edgeThreshold = 10; 
        double sigma = 1.6; */ //extractor = cv::SiftDescriptorExtractor::create(nfeatures, nOctaveLayers, contrastThreshold, edgeThreshold, sigma); /* int nfeatures = 500;
        float scaleFactor = 1.2f;
        int nlevels = 8;
        int edgeThreshold = 31;
        int firstLevel = 0;
        int WTA_K = 2;
        cv::ORB::ScoreType scoreType = cv::ORB::HARRIS_SCORE;
        int patchSize = 31;
        int fastThreshold = 20; */ //extractor = cv::ORB::create(nfeatures, scaleFactor, nlevels, edgeThreshold, firstLevel, //    WTA_K, scoreType, patchSize, fastThreshold); /* cv::AKAZE::DescriptorType descriptor_type = cv::AKAZE::DESCRIPTOR_MLDB;
        int descriptor_size = 0;
        int descriptor_channels = 3;
        float threshold = 0.001f;
        int nOctaves = 4;
        int nOctaveLayers = 4;
        cv::KAZE::DiffusivityType diffusivity = cv::KAZE::DIFF_PM_G2; */ //extractor = cv::AKAZE::create(descriptor_type, descriptor_size, descriptor_channels,  //    threshold, nOctaves, nOctaveLayers, diffusivity); /* int bytes=32;
        bool use_orientation = false; */ //extractor = cv::xfeatures2d::BriefDescriptorExtractor::create(bytes,use_orientation); //... Do nothing // perform feature description