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.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/261500/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/261500/image.jpeg)
댓글 수: 0
채택된 답변
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:
댓글 수: 0
추가 답변 (2개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!