Segmentation of PCB iamge

5 次查看(过去 30 天)
Hello! Please help me.
I want to segment the PCB image "3(template).jpg" into line and pad segments. How do we segment this image.

采纳的回答

Selva Karna
Selva Karna 2020-1-14
Hi Check this code,
clc
clear all;
close all;
%%
rgb=imread('im.jpeg');
gray=rgb2gray(rgb);
bw=im2bw(~gray,0.2);
clrb=imdilate(bw,strel('disk',2,4));
I=rgb(:,:,1);
BW=clrb;
[nbwl,cnt]=bwlabel(BW);
msk=zeros(2020,2020);
for i=1:cnt
fhls=find(nbwl==i);
msk(fhls)=i;
seg=label2rgb(msk);
st=i;
imwrite(seg,sprintf('%d.jpg',i))
imshow(seg)
pause(0.8);
drawnow()
end
Results:

更多回答(2 个)

Selva Karna
Selva Karna 2020-1-14
9.jpg

Selva Karna
Selva Karna 2020-1-14
check this attachment
  3 个评论
Selva Karna
Selva Karna 2020-1-28
yes, you just convert binary image & segment holes [white pixel list]
Wutt Yi Tun
Wutt Yi Tun 2020-2-7
Thank you! I got the segmented images (holes, lines and pads seperately). Thank you so much!!!

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by