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

2 visualizaciones (últimos 30 días)
Nilesh Hampiholi
Nilesh Hampiholi el 4 de Oct. de 2021
Comentada: Nilesh Hampiholi el 4 de Oct. de 2021
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:

Respuestas (1)

Image Analyst
Image Analyst el 4 de Oct. de 2021
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 comentario
Nilesh Hampiholi
Nilesh Hampiholi el 4 de Oct. de 2021
Yes but the refrence blob is not an image. Its just 2d points that I have plotted.

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by