2016-08-15 70 views
4

任何人都可以提出检测每个目标的中心使用MATLBAB下面的图片替代手段:检测目标的中心在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 任何人都可以提出一种检测十字准线中心的方法吗?由于

+0

如果您认为此方法对噪点敏感,请在处理之前尝试对图像进行去噪。 –

+1

我没有使用Matlab,但我认为可能使用HoughCircles方法,在这个函数[HERE]中执行(http://se.mathworks.com/help/images/ref/imfindcircles.html)。图像中的圆圈不完整,但是通过适当的去噪和处理后的输入图像和正确的参数,它可能会给出圆圈的坐标。 –

+0

我同意Hough变换值得尝试,即使圆圈不完整。缺点是你无法将其推广到遗传形状,但它可能在这里工作。 – eigenchris

回答

1

我的改装工程100%的效率,为你的形象:

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增长的地区和连接分离的区域。