Пример #1
0
	//--------------------------------------------------
	// As of writing this, you can use:
	// FAST, STAR, SIFT, SURF, MSER, GFTT, HARRIS, L
	vector<KeyPoint> MatchableImage::findFeatures(string alg_name)
	{
		log(LOG_LEVEL_DEBUG, "finding features using %s", alg_name.c_str());
		
		
		if(featuresCurrent && featureAlgUsed.compare(alg_name)==0) return features;
		
		if(empty())
		{
			log(LOG_LEVEL_ERROR, "in findFeatures(), image is empty");
		}
		
		
		// "L" isn't in the "createDetector" thingie.
		// TO DO:  Figure out what these vars do & how to pass them in!
		// For that matter, how to pass in parameters to any of the other feature detectors?
		if(alg_name.compare("L")==0)
		{
			Size patchSize(32, 32);
			int radius = 7;
			int threshold = 20;
			int nOctaves=2;
			int nViews=2000;
			int clusteringDistance = 2;
			ldetector = LDetector(radius, threshold, nOctaves, nViews, patchSize.width, clusteringDistance);
			ldetector.setVerbose(true);
			
			double backgroundMin=0;
			double backgroundMax=256;
			double noiseRange=5;
			bool randomBlur=true;
			double lambdaMin=0.8;
			double lambdaMax=1.2;
			double thetaMin=-CV_PI/2;
			double thetaMax=CV_PI/2;
			double phiMin=-CV_PI/2;
			double phiMax=CV_PI/2;
			gen = PatchGenerator(backgroundMin, backgroundMax, noiseRange, randomBlur, 
								 lambdaMin, lambdaMax, thetaMin, thetaMax, phiMin, phiMax);
			int maxPoints=100;
			ldetector.getMostStable2D(bw(), features, maxPoints, gen);
		}
		else 
		{
			Ptr<FeatureDetector> detector = createFeatureDetector( alg_name );
			if(detector==0)
			{
				log(LOG_LEVEL_ERROR, "Feature detector %s not found!", alg_name.c_str());
			}
			
			detector->detect( bw(), features );
		}
		
		log(LOG_LEVEL_DEBUG, "in findFeatures(), %d features", features.size());
		featuresCurrent = true;
		descriptorsCurrent = false;
		matcherTrained=false;
		featureAlgUsed=alg_name;
		return features;
	}
Пример #2
0
void Learner::init(Detector *_detector)
{
    detector = _detector;
    
    patchGenerator = PatchGenerator(0, 0, DETECTOR_UPDATE_WARP_NOISE, DETECTOR_UPDATE_WARP_BLUR, 1. - DETECTOR_UPDATE_WARP_SCALE, 1. + DETECTOR_UPDATE_WARP_SCALE, -DETECTOR_UPDATE_WARP_ANGLE, DETECTOR_UPDATE_WARP_ANGLE, -DETECTOR_UPDATE_WARP_ANGLE, DETECTOR_UPDATE_WARP_ANGLE);
}