2017-04-08 157 views
0

嘿,我試圖解決這個問題。在哪裏被要求將圖像中的「斑馬」分割出來。以下是給定的圖像。圖像處理:在圖像中分割「斑馬紋」

"Zebra"

和輸出應該是這樣的。

Output

好吧,我就死在他們可能會分割爲獨立的對象斑馬事業的「條」。

+0

你爲什麼不添加的東西你試過? –

+0

我是IP初學者,我使用了openCV提供的一些標準算法。但他們也把條視爲物體。 – user7837687

+0

如果你是初學者,你應該做其他事情。有一天你會收集足夠的知識來了解什麼是必要的。 – Piglet

回答

0

在圖像處理中,重要的是看看你的圖像,並試圖理解你感興趣的區域(即斑馬)和其餘部分(即背景)之間的差異。

在這個例子中,一個明顯的區別是背景是相當綠色和斑馬黑色和白色。因此,圖像的綠色通道可用於提取背景。之後,可以使用一些擴張和侵蝕步驟(非線性)清理結果。

一個簡單的和不完美的分割技術(在Matlab):

I = imread('lA196m.jpg'); 

% plot the original image 
figure 
subplot(2,2,1) 
imshow(I) 

% calculate the green channel (relative green value) 
greenChannel = double(I(:,:, 2))./mean(I(:,:,:), 3); 
binary = greenChannel > 1; % apply a thresshold 
subplot(2,2,2) 
imshow(binary); 

% remove false positives (backgrounds) 
se1 = strel('sphere',20); 
binary2 = imdilate(imerode(binary,se1), se1); 
subplot(2,2,3) 
imshow(binary2); 

% add false negatives 
se2 = strel('sphere',10); 
binary3 = imerode(imdilate(binary2,se2), se2); 
subplot(2,2,4) 
imshow(binary3); 

% calculate & plot the boundary on the original image 
subplot(2,2,1) 
Bs = bwboundaries(~binary3); 
B = Bs{1}; 
hold on 
plot(B(:, 2), B(:, 1), 'LineWidth', 2); 

enter image description here