在MATLAB中检测目标中心

4

请问有没有其他方法可以使用MATLAB检测以下图像中每个目标的中心:

Targets

我的当前方法使用regionprops和重心检测。

clc,  clear all, close all
format long
beep off
rng('default')

I=imread('WP_20160811_13_38_26_Pro.jpg');


BW=im2bw(I);
BW=imcomplement(BW);

s  = regionprops(BW, 'area','Centroid');

centroids = cat(1, s.Centroid);
imshow(BW)
hold on
plot(centroids(:,1), centroids(:,2), 'b*')
hold off

这种方法似乎对噪声、透视畸变等很敏感,是否有更精确的检测中心的方法?是否能找到每个四分之一圆弧的交点。

我考虑的另一种目标是: enter image description here 有人能提出一种检测十字准星中心的方法吗?谢谢


如果您认为这种方法对噪声敏感,请在处理之前对图像进行去噪。 - Amitay Nachmani
1
我没有使用过Matlab,但我认为可以使用HoughCircles方法,在此函数HERE中执行。您图像中的圆不完整,但是通过适当去噪和处理输入图像以及正确的参数,它可能会给出圆的坐标。 - Dainius Šaltenis
我认为霍夫变换值得一试,即使圆不完整。缺点是您将无法将其推广到其他形状,但在这里可能有效。 - eigenchris
1个回答

2
我的修改对您的图像百分之百有效。
I = imadjust(imcomplement(rgb2gray(imread('WP_20160811_13_38_26_Pro.jpg'))));
filtered_BW = bwareaopen(im2bw(I), 500, 4);
% 500 is the area of ignored objects

final_BW = imdilate(filtered_BW, strel('disk', 5));

s  = regionprops(final_BW, 'area','Centroid');
centroids = cat(1, s([s.Area] < 10000).Centroid);
% the condition leaves out the big areas on both sides

figure; imshow(final_BW)
hold on
plot(centroids(:,1), centroids(:,2), 'b*')
hold off

enter image description here

我正在添加的功能:
  • rgb2gray 使图像只有一个值维度!
  • imadjust 自动优化亮度和对比度,
  • bwareaopen 去除小岛屿,
  • imdilatestrel 扩大区域并连接不连通的区域。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接