如何获得正确匹配的function

我正在两个不同的图像中进行特征检测,并且来自描述符匹配器的结果图像包含不属于彼此的特征,如下面的img_1所示。

我遵循的步骤如下:

  1. 使用SIFT算法进行特征检测。 此步骤为每个图像生成MatOdKeyPoint对象,这意味着MatKeyPts_1和MatKeyPts_2
  2. 使用SURF算法的描述符提取器。
  3. 描述符匹配使用BRUTFORCE算法。 此步骤的代码发布在下面, query_imgtrain_img的描述符提取器在此步骤中用作输入。 我也使用自己创建的类来控制和维护这个过程。

问题是,步骤3的结果是img_1下面发布的图像,它具有与其他人相关的完全不相似的特征,我希望看到,例如,手的特定区域(img_1,右)被链接在(img_1,左)手中的类似function,但正如你所看到我有混合和无关的function。

我的问题是如何使用SIFT和SURF作为特征检测器和描述符提取器分别获得正确的特征匹配?

 private static void descriptorMatcher() { // TODO Auto-generated method stub MatOfDMatch matDMatch = new MatOfDMatch();//empty MatOfDmatch object dm.match(matFactory.getComputedDescExtMatAt(0), matFactory.getComputedDescExtMatAt(1), matDMatch);//descriptor extractor of the query and the train image are used as parameters matFactory.addRawMatchesMatDMatch(matDMatch); /*writing the raw MatDMatches*/ Mat outImg = new Mat(); Features2d.drawMatches(matFactory.getMatAt(0), matFactory.getMatKeyPtsAt(0), matFactory.getMatAt(1), matFactory.getMatKeyPtsAt(1), MatFactory.lastAddedObj(matFactory.getRawMatchesMatDMatchList()), outImg); matFactory.addRawMatchedImage(outImg); MatFactory.writeMat(FilePathUtils.newOutputPath(SystemConstants.RAW_MATCHED_IMAGE), MatFactory.lastAddedObj(matFactory.getRawMatchedImageList()));//this produce img_2 below posted /*getting the top 10 shortest distance*/ List dMtchList = matDMatch.toList(); List goodDMatchList = MatFactory.getTopGoodMatches(dMtchList, 0, 10);//this method sort the dMatchList ascendingly and picks onlt the top 10 distances and assign these values to goodDMatchList /*converting the goo DMatches to MatOfDMatches*/ MatOfDMatch goodMatDMatches = new MatOfDMatch(); goodMatDMatches.fromList(goodDMatchList); matFactory.addGoodMatchMatDMatch(goodMatDMatches); /*drawing the good matches and writing the good matches images*/ Features2d.drawMatches(matFactory.getMatAt(0), matFactory.getMatKeyPtsAt(0), matFactory.getMatAt(1), matFactory.getMatKeyPtsAt(1), MatFactory.lastAddedObj(matFactory.getGoodMatchMatDMatchList()), outImg); MatFactory.writeMat(FilePathUtils.newOutputPath(SystemConstants.GOOD_MATCHED_IMAGE), outImg);// this produce img_1 below posted } 

Img_1 在此处输入图像描述