How to ensure that the number of matches between 2 images is equal to the number given?

Using the matching features from here:
I1 = rgb2gray(imread('viprectification_deskLeft.png'));
I2 = rgb2gray(imread('viprectification_deskRight.png'));
points1 = detectHarrisFeatures(I1);
points2 = detectHarrisFeatures(I2);
[features1,valid_points1] = extractFeatures(I1,points1);
[features2,valid_points2] = extractFeatures(I2,points2);
indexPairs = matchFeatures(features1,features2);
matchedPoints1 = valid_points1(indexPairs(:,1),:);
matchedPoints2 = valid_points2(indexPairs(:,2),:);
figure; showMatchedFeatures(I1,I2,matchedPoints1,matchedPoints2);
How do I ensure that the number of matches found is equal to a number given e.g. 170?
If not, then how can I ensure that for every point in valid_points1 there is a corresponding point in valid_points2.
So if valid_points1 is 170 points in total, then indexPairs should also be 170 points.

 採用された回答

Qu Cao
Qu Cao 2020 年 11 月 20 日

0 投票

You can set 'MatchThreshold' to 100 and 'MaxRatio' to 1.

1 件のコメント

Animesh Shankar
Animesh Shankar 2020 年 11 月 20 日
編集済み: Animesh Shankar 2020 年 11 月 20 日
Yes. That definitely helps!
What if I want the same number of points as points1 in this case?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeComputer Vision Toolbox についてさらに検索

製品

リリース

R2020b

質問済み:

2020 年 11 月 19 日

編集済み:

2020 年 11 月 20 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by