2016-08-15 71 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增長的地區和連接分離的區域。