PCB Image Detection in GUI

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 Kommentare

KIVANÇ mutlu
KIVANÇ mutlu am 30 Mai 2020
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 am 30 Mai 2020
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 am 31 Mai 2020
Bearbeitet: Image Analyst am 31 Mai 2020
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 am 31 Mai 2020
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 am 1 Jun. 2020
The images are as attached below.
img3 is the imabsdiff of the 2 images below
Image Analyst
Image Analyst am 1 Jun. 2020
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 am 1 Jun. 2020
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 am 3 Jun. 2020
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 am 4 Jun. 2020
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.

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Image Analyst
Image Analyst am 20 Mai 2020
Bearbeitet: Image Analyst am 20 Mai 2020

0 Stimmen

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 Kommentar

Lee Hao Nam
Lee Hao Nam am 23 Mai 2020
alright, thank you for the references. Will try to get around it

Melden Sie sich an, um zu kommentieren.

Giselle Roy
Giselle Roy am 10 Jun. 2020

0 Stimmen

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 am 8 Feb. 2023

0 Stimmen

Code please

2 Kommentare

Image Analyst
Image Analyst am 8 Feb. 2023
Bearbeitet: Image Analyst am 8 Feb. 2023
To learn how to write MATLAB code, invest 2 hours of your time here:
DGM
DGM am 8 Feb. 2023
Bearbeitet: DGM am 8 Feb. 2023
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.

Melden Sie sich an, um zu kommentieren.

Gefragt:

am 20 Mai 2020

Bearbeitet:

am 8 Feb. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by