image compareImages

Automated Product Defect Detection using SSIM

Scénario de test & Cas d'usage

Business Context

A manufacturing plant produces electronic circuit boards. To ensure quality consistency, the system must verify that each newly manufactured board (Source) matches the 'Golden Master' board (Reference). The goal is to detect significant visual defects or misalignments using the Structural Similarity Index (SSIM).
About the Set : image

Image processing, manipulation, and analysis.

Discover all actions of image
Data Preparation

Simulation of image data loading. We create two tables: 'PRODUCTION_LINE' (Source) and 'GOLDEN_MASTER' (Reference) containing binary image placeholders and file paths.

Copied!
1DATA casuser.production_line;
2 LENGTH _path_ $255 _image_ $1024;
3 INPUT _path_ $;
4 _image_ = '010101'b; /* Simulated binary image blob */
5 DATALINES;
6board_a1.jpg
7board_a2.jpg
8board_a3.jpg
9;
10RUN;
11
12DATA casuser.golden_master;
13 LENGTH _path_ $255 _image_ $1024;
14 INPUT _path_ $;
15 _image_ = '010101'b; /* Simulated binary image blob */
16 DATALINES;
17board_a1.jpg
18board_a2.jpg
19board_a3.jpg
20;
21RUN;

Étapes de réalisation

1
Verify input tables are loaded correctly in CAS.
Copied!
1PROC CAS;
2 TABLE.tableInfo / caslib='casuser' name='production_line';
3 TABLE.tableInfo / caslib='casuser' name='golden_master';
4RUN;
2
Execute image comparison using default SSIM method, matching images by file path.
Copied!
1PROC CAS;
2 image.compareImages /
3 sourceImages={TABLE={name='production_line', caslib='casuser'}}
4 referenceImages={TABLE={name='golden_master', caslib='casuser'}}
5 casOut={name='defect_report', caslib='casuser', replace=true}
6 method='SSIM'
7 pairOnPath=true;
8RUN;

Expected Result


A 'defect_report' table is generated containing SSIM scores for each circuit board. High scores (near 1.0) indicate a pass, while lower scores trigger a manual review.