image condenseImages

Processing Planar Satellite Data for Crop Monitoring

Scénario de test & Cas d'usage

Business Context

An agri-tech company processes satellite imagery to monitor crop health. To optimize transmission, the satellite sends data in a 'planar' format (Grouped Channels): sending all Red values first, then all Green, then all Blue for a given sector. The system must reconstruct these into standard RGB images for analysis.
About the Set : image

Image processing, manipulation, and analysis.

Discover all actions of image
Data Preparation

Creation of a dataset representing 2 agricultural zones. Each zone is a 2x2 image (4 pixels). The data is organized by channel: 4 Red values, then 4 Green, then 4 Blue.

Copied!
1DATA satellite_feed;
2 DO zone_id = 1 to 2;
3 /* Channel 0: Red (4 pixels) */
4 DO i = 1 to 4; pixel_val = 200; OUTPUT; END;
5 /* Channel 1: Green (4 pixels) */
6 DO i = 1 to 4; pixel_val = 150; OUTPUT; END;
7 /* Channel 2: Blue (4 pixels) */
8 DO i = 1 to 4; pixel_val = 50; OUTPUT; END;
9 END;
10RUN;
11 
12PROC CASUTIL;
13 load DATA=satellite_feed outcaslib='casuser' casout='sat_pixels' replace;
14RUN;

Étapes de réalisation

1
Execute condenseImages with the 'groupedChannels=true' parameter to correctly interpret the planar data structure.
Copied!
1PROC CAS;
2 image.condenseImages /
3 TABLE={caslib='casuser', name='sat_pixels'},
4 width=2,
5 height=2,
6 numberOfChannels=3,
7 groupedChannels=true,
8 inputs={{name='pixel_val'}},
9 copyVars={'zone_id'},
10 casOut={caslib='casuser', name='sat_images', replace=true};
11RUN;

Expected Result


The output table 'sat_images' should contain 2 rows. The images should be correctly interpreted as RGB composites (combining the separate R, G, B blocks) rather than a grayscale sequence, thanks to the groupedChannels parameter.