Scénario de test & Cas d'usage
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.
| 1 | DATA 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; |
| 6 | RUN; |
| 1 | PROC CAS; |
| 2 | TABLE.loadTable / |
| 3 | caslib='casuser' path='qc_images.sashdat' |
| 4 | casOut={name='qc_images_input', caslib='casuser', replace=true}; |
| 5 | QUIT; |
| 1 | PROC 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 | ]; |
| 9 | QUIT; |
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.