1. 程式人生 > >opencv中匹配點對的座標提取

opencv中匹配點對的座標提取

在opencv中,特徵檢測、描述、匹配都有整合的函式。vector<DMatch> bestMatches;用來儲存得到的匹配點對。那麼如何提取出其中的座標呢?

        int index1, index2;
	for (int i = 0; i < bestMatches.size(); i++)//將匹配的特徵點座標賦給point
	{
		index1 = bestMatches.at(i).queryIdx;
		index2 = bestMatches.at(i).trainIdx;

		cout << keyImg1.at(index1).pt.x << " "
		     << keyImg1.at(index1).pt.y << " "
		     << keyImg2.at(index2).pt.x << " "
		     << keyImg2.at(index2).pt.y << endl;
	}