The `annotateImages` action overlays various annotations onto images within a CAS table. This is useful for visualizing results from image analysis tasks like object detection, segmentation, or feature extraction. You can draw lines, points, or complex shapes defined by protobuf messages, and even overlay segmentation masks with specified color maps and transparency. The resulting annotated images are saved to an output CAS table.
| Parameter | Description |
|---|---|
| annotations | Specifies the annotations to be performed on the images. |
| casOut | Specifies the output table to store the annotated images. |
| copyVars | Specifies a list of variables to be copied from the input table to the output table. |
| decode | When set to true, decodes the input images. This is necessary if the images are compressed. |
| images | Specifies the input table containing the images to be annotated. |
| annotationType | Specifies the type of annotation. Can be 'LINES', 'POINTS', 'PROTOBUF', or 'SEGMENTATION'. |
| thickness | Specifies the thickness of the lines or points in pixels. |
| colorMap | Specifies the color map for segmentation annotations. |
| transparency | Specifies the transparency percentage for segmentation overlays. |
This example demonstrates how to load images from a specified path into a CAS table and prepare it for annotation. We add columns for points and lines that will be used by the `annotateImages` action.
| 1 | /* Create a CAS table with images and annotation data */ |
| 2 | PROC CAS; |
| 3 | LOADACTIONSET 'image'; |
| 4 | /* Load images into a CAS table */ |
| 5 | loadimages path='path/to/your/images' casout={name='my_images', caslib='casuser', replace=true}; |
| 6 | /* Add columns for annotations */ |
| 7 | altertable 'my_images' addcolumn={name='_points_', type='varchar'}; |
| 8 | altertable 'my_images' addcolumn={name='_lines_', type='varchar'}; |
| 9 | /* You would typically populate these columns with annotation data from another source or a previous analysis step */ |
| 10 | QUIT; |
This example demonstrates how to annotate images by drawing red points. The points are defined in the `_points_` column of the input table.
| 1 | PROC CAS; |
| 2 | image.annotateImages / |
| 3 | TABLE={name='my_images', caslib='casuser'}, |
| 4 | casOut={name='annotated_images_points', caslib='casuser', replace=true}, |
| 5 | annotations=[ |
| 6 | {annotation={annotationType='POINTS', r=255, representation={representationType='SINGLE_COLUMN', columnName='_points_'}}} |
| 7 | ]; |
| 8 | QUIT; |
This example shows how to perform multiple annotations. It draws blue lines with a specified thickness and overlays a segmentation mask using the 'JET' colormap with 50% transparency.
| 1 | PROC CAS; |
| 2 | image.annotateImages / |
| 3 | TABLE={name='my_images', caslib='casuser'}, |
| 4 | casOut={name='annotated_images_detailed', caslib='casuser', replace=true}, |
| 5 | annotations=[ |
| 6 | {annotation={annotationType='LINES', b=255, thickness=3, representation={representationType='SINGLE_COLUMN', columnName='_lines_'}}}, |
| 7 | {annotation={annotationType='SEGMENTATION', image='_segmentation_mask_', colorMap='JET', transparency=50}} |
| 8 | ]; |
| 9 | QUIT; |
This example annotates images using object detection bounding boxes stored in a Protobuf format column named `_protobuf_`. This is a common scenario when working with deep learning model outputs.
| 1 | PROC CAS; |
| 2 | image.annotateImages / |
| 3 | TABLE={name='my_images', caslib='casuser'}, |
| 4 | casOut={name='annotated_images_protobuf', caslib='casuser', replace=true}, |
| 5 | annotations=[ |
| 6 | {annotation={annotationType='PROTOBUF', representation={representationType='SINGLE_COLUMN', columnName='_protobuf_'}}} |
| 7 | ]; |
| 8 | QUIT; |
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...
A radiologist is reviewing a batch of brain MRI scans. A preliminary AI model has identified potential anomalies (e.g., tumors) and marked their centers with coordinates. Howeve...
An autonomous vehicle's perception system identifies objects (cars, pedestrians), classifies drivable areas (road, lane markings), and plans a trajectory. This complex scenario ...