2017-04-03 7 views
0

トライボロジーサンプルで画像処理を行っています。私は、画像から摩耗トラックを分割するが、繰り返し発生する問題持っている:完全な失敗にしきい値が低すぎるリードを設定背景がほとんど囲まれていることを検出

Image 1 - wear track

を。それを高く設定すると(画像のように)、ラベルによってほぼ包囲されているにもかかわらず、複数の領域につながります。トラックの幅を推定するために私が使用している距離変換を混乱させ、ラベルに検出してマージする必要があります。

私は、ラベルの品質を改善するために形態操作を使用しましたが、画像の残りの部分的な影響のために構造要素を大きくしたくありません。ラベルの曲率により、凸包を使用することができなくなります。ラベルの大部分は、ラベルの堅さを指標として使用できないようにします。不要な内部オブジェクトはラベルで完全に囲まれていないため、オイラー特性などでは検出できません。

「ほとんど完全に」フォアグラウンドオブジェクトで囲まれている背景オブジェクトを検出する良い方法はありますか?

+0

データではメソッドをテストするのは難しいですが、私は[流域](https://www.mathworks.com/help/images/ref/watershed.html)があなたのケースで役立つと思います – user2999345

答えて

2

は、私は別の領域に背景を分割するwatershedを使用して、bwboundaries前景オブジェクトと共有されているどのくらいの地域の境界を検出する:あなたはあなたの生を与えていない

% generate example image 
bw = im2double(rgb2gray(imread('example.jpg'))) == 1; 
% dilate binary object to overlap watershed boundaries 
bwDil = imdilate(bw,ones(5)); 
% get watershed labels 
D = bwdist(bw); 
D = -D; 
D(bw) = -Inf; 
L = watershed(D); 
% get binary regions and remove fg object 
R = (L > 0); 
R(bw) = 0; 
% get boundaries of all regions 
BR = bwboundaries(R); 
% set boundary ratio - if a regio's shares more boundary with fg object 
% than this threshold it considered surrounded 
boundaryRatio = zeros(numel(BR),1); 
ratioThresh = 0.6; 
mask = false(size(bw)); 
% go through region boundaries and add them to mask if above tresh 
for ii = 1:numel(BR) 
    ind = sub2ind(size(bw),BR{ii}(:,1),BR{ii}(:,2)); 
    boundaryRatio(ii) = nnz(bwDil(ind))/numel(ind); 
    if boundaryRatio(ii) > ratioThresh 
     mask(ind) = 1; 
    end 
end 
% fill mask 
mask = imfill(mask,4,'holes'); 
% plot 
subplot(121); 
imshow(bw); 
title('fg') 
rgb = double(cat(3,mask,bw,bw)); 
subplot(122); 
imshow(rgb); 
title('fg with surrounded bg') 

surrounded

関連する問題