How to find best match between points in image and a set points ?

1 回表示 (過去 30 日間)
Nilesh Hampiholi
Nilesh Hampiholi 2021 年 10 月 4 日
コメント済み: Nilesh Hampiholi 2021 年 10 月 4 日
Hello,
I am a student and have a problem in my project. So I have set of ultrasound images and after thresholding I have a black and white image with 9 points as shown. Now I have a virtual phantom whose geometry is known. So I have created the phantom which have N number of 2D point plane. Now I need to match the image to 2d point plain. I understand that I have to implement RANSAC or similar algorithm but I do not understand how to implement.
2d point plane :
Image:

回答 (1 件)

Image Analyst
Image Analyst 2021 年 10 月 4 日
I don't think RANSAC is what I'd use. Can't you just say the matching blob is the one that has the closest centroid to the reference? So just use regionprops() to get the centroids. Untested code:
propsRef = regionprops(maskRef, 'Centroid');
xyRef = vertcat(propsRef.Centroid)
propsTest = regionprops(maskTest, 'Centroid');
xyTest = vertcat(propsTest.Centroid)
% Then find the closest blob to each reference blob
for k = 1 : numel(propsTest)
allDistances = sqrt((xyRef(k, 1) - xyTest(:, 1)) .^ 2 + (xyRef(k, 2) - xyTest(:, 2)) .^ 2);
[minDistance, indexOfClosest(k)] = min(allDistances);
% Draw a line between the blobs
line([xyRef(k, 1), xyTest(indexOfClosest(k), 2)], [xyRef(k, 2), xyTest(indexOfClosest(k, 2)], 'Color', 'r', 'LineWidth', 2);
end
Now for each reference blob you know the index of the closest test blob.
You could probably also use knnsearch() instead of the for loop.
  1 件のコメント
Nilesh Hampiholi
Nilesh Hampiholi 2021 年 10 月 4 日
Yes but the refrence blob is not an image. Its just 2d points that I have plotted.

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

カテゴリ

Help Center および File ExchangeGet Started with Image Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by