image

extractDetectedObjects

Description

Extracts object detections from images. This action allows for cropping or highlighting detected objects using various bounding box coordinate formats such as COCO, RECT, or YOLO.

Settings
ParameterDescription
casOutSpecifies the settings for an output table.
coordTypeSpecifies the type of input format to use for the bounding boxes around the detected objects. Values: COCO, RECT (default), YOLO.
copyVarsSpecifies the variables to copy from the input table to the output table.
decodeWhen set to True, writes decoded images and metadata to the output table. Default is FALSE.
extractTypeSpecifies the type of extract action to perform. Values: CROP, HIGHLIGHT (default).
imageSpecifies the name of the column that contains image binaries. Default is '_image_'.
maxObjectsSpecifies the maximum number of detected objects to extract from the image data in the input table. Default is 10.
outputFormatSpecifies whether to save the cropped detections from a single image in multiple columns and one row or in one column and multiple rows. Default is MULTIPLE_ROWS.
tableSpecifies the input table that contains image data.
Data Preparation View data prep sheet
Load Data

Load images containing object detection data into a CAS table.

Copied!
1 
2PROC CAS;
3image.loadImages / path="images" caslib="CASUSER" casOut={name="input_data", replace=true};
4RUN;
5 

Examples

Extracts and highlights detected objects using default settings.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 image.extractDetectedObjects /
3 TABLE={name="input_data"}
4 casOut={name="highlighted_images", replace=true}
5 extractType="HIGHLIGHT";
6RUN;
Result :
Output table 'highlighted_images' containing images with highlighted object bounding boxes.

Crops detected objects using YOLO coordinates, limits to 5 objects, and saves as multiple rows.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 image.extractDetectedObjects /
3 TABLE={name="input_data"}
4 casOut={name="cropped_objects", replace=true}
5 coordType="YOLO"
6 extractType="CROP"
7 maxObjects=5
8 outputFormat="MULTIPLE_ROWS";
9RUN;
Result :
Output table 'cropped_objects' with individual rows for each cropped object.

FAQ

What is the primary function of the extractDetectedObjects action?
Which parameter is used to specify the input table containing the image data?
How can I define the output table for the results?
What formats are supported for the bounding box coordinates via the coordType parameter?
What are the available extraction types?
How can decoded images be included in the output table?
How does the outputFormat parameter affect the structure of the output table?
Is there a limit to the number of detected objects that can be extracted?
How can I specify which column contains the image binaries?
Can I copy variables from the input table to the output table?