Neighborhood filtering of different images
5 views (last 30 days)
Show older comments
Hello, I have this grayvalue image.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/241603/image.bmp)
I got 2 different images from sensor, and I sort centroids of reference (red x) and distroted image (green x).
I overlays reference centroids (red x) on distorted image (green x).
But I have trouble to calculate differences between centroids because I have different matrix size of centroids of reference and distorted images.
For the reference image, I got (160 x 2). / For the distorted image, I got (163 x 2).
I attached sortedcentroids1 (reference) and sortedcentroids2 (distorted).
![area_compare spots.bmp](https://www.mathworks.com/matlabcentral/answers/uploaded_files/241605/area_compare%20spots.bmp)
I want to filter out the centroids by using neighborhood filter within certain area, but I have no idea to do this.
I only tried like this to make a function, but it is not related to the neighborhood detection.
Can someone please provide a good idea for me to solve this problem?
else numel(sortedcentroids1(:,1)) < numel(sortedcentroids2(:,1))
f = find(abs(sortedcentroids2(1:numel(sortedcentroids1(:,1)),2)-...
sortedcentroids1(:,2))>100);
sortedcentroids2(f(1),:)=[];
0 Comments
Answers (1)
Sid Singh
on 22 Oct 2019
Hi, you can use knnsearch to find the nearest neighbours to reference centroids. In your case, distorted points are missing for some reference points and vice versa but some points are very close for which I hope you want to compute the difference.
After doing the 1 nearest neighbour search for every reference point, threshold out those which are too far from normal and take the difference of the remaining points.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!