Esempio n. 1
0
void match2ind(int maxNum, const Matching& matches, Mat_i& indices) {
	assert(maxNum > 0);

	indices.resize(maxNum, 1);
	indices.fill(-1);
	for (int i = 0; i < matches.num; i++) {
		int idx1 = matches[i].idx1;
		int idx2 = matches[i].idx2;

		indices.data[idx1] = idx2;
	}
}
void getMatchIndices(Matching& matches, int maxInd, Mat_i& ind, bool inverse) {
	ind.resize(maxInd, 1);
	ind.fill(-1);
	if (!inverse) {
		for (int i = 0; i < matches.num; i++) {
			int idx1 = matches[i].idx1;
			int idx2 = matches[i].idx2;
			ind.data[idx1] = idx2;
		}
	} else {
		for (int i = 0; i < matches.num; i++) {
			int idx1 = matches[i].idx1;
			int idx2 = matches[i].idx2;
			ind.data[idx2] = idx1;
		}
	}
}