Example #1
0
// Match one feature set with another.
bool matchFeatures(const FeatureSet &f1, const FeatureSet &f2, vector<FeatureMatch> &matches, int matchType) {
	// Match features using one of two matching functions depending on value of matchType
	//   1: SSD Match   - Set match score to be the SSD (summed squared distance) between two features 
	//   2: Ratio Match - Set match score to be the SSD of the best feature divided by the SSD of the
	//                    second best feature
	switch (matchType) {
	case 1:
		ssdMatchFeatures(f1, f2, matches);
		return true;
	case 2:
		ratioMatchFeatures(f1, f2, matches);
		return true;
	default:
		return false;
	}
}
// Match one feature set with another.
bool matchFeatures(const FeatureSet &f1, const FeatureSet &f2, vector<FeatureMatch> &matches, double &totalScore, int matchType) {
    // TODO: We have given you the ssd matching function, you must write your own
    // feature matching function for the ratio test.
        
    printf("\nMatching features.......\n");

    switch (matchType) {
    case 1:
        ssdMatchFeatures(f1, f2, matches, totalScore);
        return true;
    case 2:
        ratioMatchFeatures(f1, f2, matches, totalScore);
        return true;
    default:
        return false;
    }
}