2017-04-08 50 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