image annotateImages

Manufacturing: Circuit Board Defect Visualization

Scénario de test & Cas d'usage

Business Context

A factory uses automated optical inspection to find defects on circuit boards. After a detection model identifies defect coordinates, this scenario uses `annotateImages` to draw bounding boxes around the defects for review by a quality control engineer. This is a standard, high-volume operational task.
About the Set : image

Image processing, manipulation, and analysis.

Discover all actions of image
Data Preparation

Create a simulated table of circuit board images. One image has a single defect, another has two defects, and a third has no defects. The defect locations are stored as line coordinates for drawing bounding boxes.

Copied!
1DATA casuser.qc_images;
2 LENGTH _image_ $10 _lines_ $512 image_id $20 defect_type $15;
3 image_id = 'PCB_SN_1001'; defect_type='none'; _lines_=''; _image_=''; OUTPUT;
4 image_id = 'PCB_SN_1002'; defect_type='solder_bridge'; _lines_='x1:100,y1:150,x2:120,y2:150;x1:120,y1:150,x2:120,y2:170;x1:120,y1:170,x2:100,y2:170;x1:100,y1:170,x2:100,y2:150'; _image_=''; OUTPUT;
5 image_id = 'PCB_SN_1003'; defect_type='misaligned_chip'; _lines_='x1:300,y1:200,x2:350,y2:200;x1:350,y1:200,x2:350,y2:220;x1:350,y1:220,x2:300,y2:220;x1:300,y1:220,x2:300,y2:200;x1:400,y1:400,x2:410,y2:400;x1:410,y1:400,x2:410,y2:410;x1:410,y1:410,x2:400,y2:410;x1:400,y1:410,x2:400,y2:400'; _image_=''; OUTPUT;
6RUN;

Étapes de réalisation

1
Load the prepared data into an in-memory CAS table.
Copied!
1PROC CAS;
2 TABLE.loadTable /
3 caslib='casuser' path='qc_images.sashdat'
4 casOut={name='qc_images_input', caslib='casuser', replace=true};
5QUIT;
2
Execute `annotateImages` to draw red bounding boxes (lines) around the defects. Copy the `image_id` and `defect_type` to the output table for easy identification.
Copied!
1PROC CAS;
2 image.annotateImages /
3 TABLE={name='qc_images_input', caslib='casuser'}
4 casOut={name='qc_images_annotated', caslib='casuser', replace=true}
5 copyVars={'image_id', 'defect_type'}
6 annotations=[
7 {annotation={annotationType='LINES', r=255, g=0, b=0, thickness=2, representation={representationType='SINGLE_COLUMN', columnName='_lines_'}}}
8 ];
9QUIT;

Expected Result


An output table `qc_images_annotated` is created. It contains the original images, but two of them now have red rectangles drawn on them corresponding to the defect coordinates. The image with no defects remains unchanged. The `image_id` and `defect_type` columns are present in the output table, allowing for easy filtering and review.