I want to check if the physical material is aligned with its bonding diagram?

4 次查看(过去 30 天)
physical material
Bonding diagram
I want to check if all the SMDs and filp dies are located in each white rectangle respectively.
How to do the alignment? Assume top-left corner of top-left rectangle is aligned with top-left corner of top-left SMD pad, but these two figures are not the same size.
  3 个评论
xie
xie 2025-2-13
编辑:xie 2025-2-13
Yes, you are right. The fiducial marks are cropped out of the image by me. that is not allocated at each unit. I just want to learn how to align two figures and detect how to find out the SMDs or Dies movement or solder bridges(maybe this defect is not covered by rectangle,so that can be detected.)

请先登录,再进行评论。

采纳的回答

praguna manvi
praguna manvi 2025-2-13
Hi @xie,
To find the alignment between two images, you can perform an "affinetform2d" transformation using key points, specifically the top corners of the first rectangle, and compare the alignment using "imshowpair." Here is an example of how to do this for the images mentioned above:
physical_image = imread("ground.png");
bounding_image = imread("masked.png");
rect_top_left = [25, 35];
smd_top_left = [17, 15];
scale_x = size(physical_image, 2) / size(bounding_image, 2);
scale_y = size(physical_image, 1) / size(bounding_image, 1);
translation_x = rect_top_left(1) - smd_top_left(1);
translation_y = rect_top_left(2) - smd_top_left(2);
tform = affinetform2d ([scale_x 0 0; 0 scale_y 0; translation_x translation_y 1]');
smd_transformed = imwarp(bounding_image, tform, 'OutputView', imref2d(size(physical_image)));
imshowpair(physical_image, smd_transformed, "blend", "Scaling", "joint");
For more information, refer to the following documentation links on the "affinetform2d," "imshowpair," and "imwarp" functions:
Additionally, here is a useful discussion thread on other techniques in general for aligning two images:
  1 个评论
xie
xie 2025-2-13
Thank you Praguna! You teach me to get a new skill.
To do fine tune the mis-alignment, I do some adjustment in you code: crop the active range at first step insead of input the top-left position(it is not easy to be defined). Thank you again!
physical_image = imread("Phisical material.png");
bounding_image = imread("BondingDiagram.png");
physical_image = imcrop(physical_image);
bounding_image = imcrop(bounding_image);
%rect_top_left = [23, 28];
%smd_top_left = [8, 16];
scale_x = size(physical_image, 2) / size(bounding_image, 2);
scale_y = size(physical_image, 1) / size(bounding_image, 1);
% translation_x = rect_top_left(1) - smd_top_left(1);
% translation_y = rect_top_left(2) - smd_top_left(2);
tform = affinetform2d ([scale_x 0 0; 0 scale_y 0])%; translation_x translation_y 1]');
smd_transformed = imwarp(bounding_image, tform, 'OutputView', imref2d(size(physical_image)));
aa=imshowpair(physical_image, smd_transformed, "blend", "Scaling", "joint");

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by