Hi, I'm trying to create a GUI to detect the defects in PCB. The image shown is the reference image that I would wish to create but I failed to search for any references to create the green boxes as detection and determine the type of defects in GUI. I'm wondering if there are any references I could refer to?

댓글 수: 9

KIVANÇ mutlu
KIVANÇ mutlu 2020년 5월 30일
I made comparison of fixed pcb images but XOR comparison does not work on samples from different locations. I need to first identify the PCB location using the fiducial reference. I want to teach fiducial points. Then he will search for these points in certain areas and determine his coordinate. According to the first reference, the periodic, that is, sliding of the pcb is determined.
Image Analyst
Image Analyst 2020년 5월 30일
KIVANC, how/where did you get his images? I don't see that he posted them.
Anyway, did you try imregister()? And can you post/attach his images?
Lee Hao Nam
Lee Hao Nam 2020년 5월 31일
편집: Image Analyst 2020년 5월 31일
Hey, I have managed to created the Boundary box around the defect using the lines of code below:
[L, num] = bwlabel(img3);
bboxes = regionprops(img3,'BoundingBox','centroid');
for k = 1:length(bboxes)
CurrBB = bboxes(k).BoundingBox;
rectangle('Position',[CurrBB(1),CurrBB(2),CurrBB(3),CurrBB(4)],'EdgeColor','g','LineWidth',2)
end
The current issue I am facing is how do I classify the types of defects
Image Analyst
Image Analyst 2020년 5월 31일
I don't know what img3 is, but you need to look at the various features of each blob, like it's area, or perimeter, or circularity, or aspect ratio, or something like that.
Lee Hao Nam
Lee Hao Nam 2020년 6월 1일
The images are as attached below.
img3 is the imabsdiff of the 2 images below
Image Analyst
Image Analyst 2020년 6월 1일
OK, so please describe in words, what are the features that describe the various classes, and give the class names, like "nick", "complete break" or whatever.
Lee Hao Nam
Lee Hao Nam 2020년 6월 1일
So the types of defects are such as:
1. Short
2. Open
3. Spurous copper
4. Mouse bite
5. Spur
The codes are as shown below up till the part where creating Bounding Boxes and texts
% Show Fig 1
a = uigetfile('*.*'); % Get all types of files
img1 = imread(a);
img1 = im2bw(img1);
figure()
imshow(img1);
% Show Fig 2
b = uigetfile('*.*'); % Get all types of files
img2 = imread(b);
img2 = im2bw(img2);
figure()
imshow(img2);
% Show Fig 3 of subtracted img1 and img2
figure()
img3 = imabsdiff(img1,img2);
imshow(img2);
[L, num] = bwlabel(img3);
bboxes = regionprops(img3,'BoundingBox','centroid');
% Obtain centroid of the boundary boxes
centroids = cat(1,bboxes.Centroid);
hold on
for k = 1:length(bboxes)
CurrBB = bboxes(k).BoundingBox;
rectangle('Position',[CurrBB(1),CurrBB(2),CurrBB(3),CurrBB(4)],'EdgeColor','g','LineWidth',2)
H= text( centroids(:,1)-9, centroids(:,2)-17,'types of defect'); % goes by column first then row
set(gcf,'DefaultTextColor','red')
end
hold off
edgar sanchez
edgar sanchez 2020년 6월 3일
do you have the full project? Im doing this for school. Can you send it too me? the code.
gary.rage@gmail.com
Today is the due date :)
Image Analyst
Image Analyst 2020년 6월 4일
edgar, I'm not sure who you're asking. I guess you're asking Lee. I don't have his code (other than the partial chunk above) and I don't know if he finished or not. All he did so far was to subtract the test image from the template/reference image and find differences and put boxes around them. He never said (despite me asking) what constitutes the 5 different types of defects, so the classification into those defects is not shown in the above code. Moreover, the code expects perfect alignment between the two images, which is not likely to happen in a real world situation. I'm dealing with that myself all week with my current project where a robot is supposed to move an object and end up back in the same position every time. It's close, but not perfect. It's not aligned perfectly to the nearest pixel so there are "edge effects" that show up a little thin lines along the edges where they did not subtract perfectly and we need to handle those.

댓글을 달려면 로그인하십시오.

답변 (3개)

Image Analyst
Image Analyst 2020년 5월 20일
편집: Image Analyst 2020년 5월 20일

0 개 추천

You can use
hold on;
rectangle('Position', [x, y, width, height], 'EdgeColor', 'g');
to create green rectangles.
For examples:
Segmentation and Preprocessing of Electrical Schematics Using Picture Graphs,
CVGIP(28), No. 3, December 1984, pp. 271-288.
A Primary Algorithm for the Understanding of Logic Circuit Diagrams,
PR(17), No. 1, 1984, pp. 125-134.
Locating, Replacing, and Deleting Patterns in Graphics Editing of Line Drawings,
CVGIP(29), No. 1, January 1985, pp. 37-46.
An Automatic Circuit Diagram Reader with Loop-Structure-Based Symbol Recognition,
PAMI(10), No. 3, May 1988, pp. 331-341.
A Topology-Based Component Extractor for Understanding Electronic Circuit Diagrams,
CVGIP(44), No. 2, November 1988, pp. 119-138.
Elsevier DOI Application, Circuit Diagrams. Automatic contour following based on the patterns that can appear. BibRef8811

댓글 수: 1

Lee Hao Nam
Lee Hao Nam 2020년 5월 23일
alright, thank you for the references. Will try to get around it

댓글을 달려면 로그인하십시오.

Giselle Roy
Giselle Roy 2020년 6월 10일

0 개 추천

hmm @Lee did you try using the CNN object detector, try classifying each defect based on it perimeter turn radius or if you have any other approach send it in, i may be able to solve it
Abi
Abi 2023년 2월 8일

0 개 추천

Code please

댓글 수: 2

Image Analyst
Image Analyst 2023년 2월 8일
편집: Image Analyst 2023년 2월 8일
To learn how to write MATLAB code, invest 2 hours of your time here:
DGM
DGM 2023년 2월 8일
편집: DGM 2023년 2월 8일
I don't know about you, but I learned as a child that saying "gimme" without actually saying what you want isn't really a successful strategy.
If you want to post an answer, post one. If you want to ask a question, ask one. This is neither. Decide what you want to do.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 S-Parameters and Linear Components에 대해 자세히 알아보기

질문:

2020년 5월 20일

편집:

2023년 2월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by