Plane OpenCVContourMatcher::compareBruteForce(Contour contour1, Contour contour2){
	//Convert from contour class to matrix
	cv::Mat c1 = sliceContour(contour1.getContourBoundary(),image1);
	cv::Mat c2 = sliceContour(contour2.getContourBoundary(),image2);
	// Detect feature points of contour 1 and contour 2
	std::vector<cv::KeyPoint> feat1 = detectFeaturePoints(c1);
	std::vector<cv::KeyPoint> feat2 = detectFeaturePoints(c2);
	// Extract feature descriptors
	cv::Mat desc1 = extractDescriptors(c1,feat1);
	cv::Mat desc2 = extractDescriptors(c2,feat2);
	// Match feature descriptors and refine matches then return as vector of PixelLocations
	std::vector<cv::DMatch> matches = matchBruteForce(desc1,desc2);
	Plane planePoints = convertDMatchesToPlane(feat1,feat2,refineMatches(matches));
	return planePoints;
}
Exemple #2
0
void performMatching(char *type)
{
    string terrainCtrlsPath,featuresPath,matchesToPassPath;
    readConfigFile(filename,"terrainCtrlsPath",terrainCtrlsPath);
    readConfigFile(filename,"featuresPath",featuresPath);
    readConfigFile(filename,"matchesToPassPath",matchesToPassPath);

    vector<Match> matches;
    readMatches(matchesToPassPath,matches);
    refineMatches(img1,img2,matches,matches,16,1,0.9);
        printMatches("/home/kevin/Documents/win7share/output/aaa.txt",matches);

//    showMatches(img1,img2,terrainCtrls,imagescale);

//    vector<KeyPoint> kpts;
//    readKeyPoints(featuresPath,kpts);
//    vector<Match> matches;
//    matchUnderTerrainControl(img1,img2,terrainCtrls,kpts,matches,16,64,32,.9);
//    cout<<matches.size()<<endl;
//    ransacTest(matches,matches);
//    cout<<matches.size()<<endl;
//    showMatches(img1,img2,matches,imagescale);
//    printMatches(terrainCtrlsPath,matches,1);
}