Geomatica’s Object Analyst provides an intuitive workflow wizard for performing image segmentation, classification and feature extraction. This all-in-one interface is designed to reduce complexity and give users the opportunity to develop highly accurate, object-based, thematic classification maps.
Because segmentation operations are memory intensive, larger files may be prevented from running if your computer has insufficient memory. This tutorial provides step-by-step instructions for a workflow that will allow you to work with larger files. The workflow presented in this tutorial involves tiling an image along natural boundaries so that the segmentation can be performed at 1:1 resolution on each tile, then reassembled with limited edge artifacts.
The following table outlines the approximate memory requirement for different image sizes:
Image Size* |
Memory Requirements (RAM)** |
|||
3 Bands |
4 Bands |
7 Bands |
12 Bands |
|
1000 x 1000 |
185 MB |
199 MB |
195 MB |
199 MB |
2000 x 2000 |
411 MB |
462 MB |
445 MB |
471 MB |
3000 x 3000 |
781 MB |
906 MB |
840 MB |
920 MB |
4000 x 4000 |
1.29 MB |
1.5 MB |
1.4 MB |
1.5 GB |
5000 x 5000 |
1.43 GB |
1.64 GB |
1.65 GB |
1.8 GB |
6000 x 6000 |
1.6 GB |
1.84 GB |
2.12 GB |
2.58 GB |
7000 x 7000 |
1.78 GB |
1.95 GB |
2.5 GB |
3.4 GB |
8000 x 8000 |
2.45 GB |
2.67 GB |
3.39 GB |
4.58 GB |
9000 x 9000 |
2.9 GB |
3.19 GB |
4.37 GB |
5.6 GB |
10000 x 10000 |
3.5 GB |
3.87 GB |
5 GB |
6.9 GB |
15000 x 15000 |
7.7 GB |
8.5 GB |
11.02 GB |
15.24 GB |
*Image Size = Rows x Columns (pixels)
**Peak Memory usage for number of image bands shown
Options for Handling Large Imagery in Object Analyst
- Downsample the imagery – The easiest method is to simply downsample the imagery to a lower resolution. This should be your first choice if your goal is to classify larger or more general objects and small detail is not so important
- Tiling along natural boundaries – This is the workflow that will be discussed in this tutorial and outlines a technique for segmenting and performing object classification at full resolution using tiling. One of the issues with tiling is that it introduces edge artifacts where the tiles meet. Our technique provides a way to minimize the edge artifacts by using natural boundaries for tiling.
Downloading Tutorial Data and Software
Please download the tutorial data package from our cloud: https://pcigeomatics.sharefile.com/d-sdbd57190ddc49a5b
Your tutorial data package should include the following file(s):
K3_20130506182405_05174_19891329_L1R_ORTHO_MS.pix - This image is an orthorectified Kompsat-3 multispectral image at 2.8m resolution with 4 bands (Red, Green, Blue, NIR)
*Note: You will need to unzip the package before you can continue with the tutorial
Geomatica 2017 or later is required for this tutorial. Click on the following link and fill in the quick form to access a free trial
Loading and Examining Your Input File
In this section we are going to simply load and review the different layers that will be used as inputs to segmentation and object-based classification
- Navigate to D:\Projects\Marketing\G2017_release_matreial\tutorial\OA_LargeFileClassification\Input and locate the K3_20130506182405_05174_19891329_L1R_ORTHO_MS.pix file
- Double click on the K3_20130506182405_05174_19891329_L1R_ORTHO_MS.pix file to open it in Geomatica’s Focus application
By default the RGB imagery will render as a true color composite (see below). The red band (channel 3), green band (channel 2) and blue band (channel 1)
- Click on the Files tab in the layer and files manager on the left side of Focus
- Right click on the image file K3_20130506182405_05174_19891329_L1R_ORTHO_MS.pix and in the context menu, select Properties
- In the File Properties window (General Tab), find the Raster Size information.
The raster size for this file is 7602 x 7071 pixels and there are 4 bands. Using the table below, we can see that the memory required to process this file is between 2.86 GB and 3.73 GB
Image Size* |
Memory Requirements (RAM)** |
|||
3 Bands |
4 Bands |
7 Bands |
12 Bands |
|
1000 x 1000 |
144 MB |
167 MB |
154 MB |
253 MB |
2000 x 2000 |
282 MB |
338 MB |
320 MB |
385 MB |
3000 x 3000 |
490 MB |
619 MB |
572 MB |
727 MB |
4000 x 4000 |
745 MB |
997 MB |
897 MB |
1.21 GB |
5000 x 5000 |
1.09 GB |
1.54 GB |
1.34 GB |
1.83 GB |
6000 x 6000 |
1.54 GB |
2.16 GB |
1.89 GB |
2.59 GB |
7000 x 7000 |
2.05 GB |
2.86 GB |
2.53 GB |
3.49 GB |
8000 x 8000 |
2.67 GB |
3.73 GB |
3.28 GB |
5.53 GB |
9000 x 9000 |
3.3 GB |
4.6 GB |
4.12 GB |
5.70 GB |
10000 x 10000 |
4.03 GB |
5.6 GB |
5.06 GB |
7.01 GB |
15000 x 15000 |
8.80 GB |
12.16 GB |
11.25 GB |
15.6 GB |
- Open up the properties window for your computer
- Verify whether you have enough memory on your PC to process this image as is or whether you need to tile the image
Initial Downsampling and Segmentation
This section will provides steps to perform an initial downsample and segmentation of the imagery. The segmentation from this section will be used to define natural boundaries which will be used for tiling (clipping) the image.
- In the Focus dropdown menu bar, click on Tools > Algorithm Librarian
- In Algorithm Librarian, click on the Find… button
- In the Find Algorithm window, type resamp and click Find Next
- Double click on the RESAMP algorithm in the Algorithm Librarian window to open it
- In the RESAMP Module Control Panel, expand the Files branch and the K3_20130506182405_05174_19891329_L1R_ORTHO_MS.pix branch so that the channels are displayed (if not already displayed)
- Select the four image channels
- At the bottom in the Output Ports section, click on Browse…
- In the File Selector window, navigate up one directory level, find the intermediates folder (empty), go into it and type the file name as resamp_k3
- Click Save
- At the top of the RESAMP Module Control Panel, click on the Input Params 1 tab
- Set both the Output Pixel X Size and Output Pixel Y Size parameters to 5.6 (2x coarser than full resolution)
- Click Run at the bottom of the RESAMP Module Control Panel
Once the process has completed, the resamp.k3 image should be rendered in the viewer.
- Close the RESAMP Module Control Panel, the Find Algorithm and Algorithm Librarian windows
- In Focus, click on the Analysis dropdown menu and select Object Analyst
- In the Object Analyst window, click on the Operation dropdown list and select Segmentation
- In the Source Image Layers section, click on the Select… button
- In the Layer Selection window, click on the File dropdown list and select the resamp_k3.pix image
- Click on the Select All button
- Click OK
- In the Parameters section, change the Scale to 250
- In the Output section, click Browse…
- In File Selector, navigate to the intermediates folder and name the file lowres_seg
- Click Save
- In the Layer dropdown list, select New Layer
- Click the Add and Run button
Once the process completes running, you will have a coarse segmentation vector layer that will be the basis for defining the tiling edges (based on natural boundaries). This layer will automatically be rendered in the Focus Viewer
- Close the Object Analyst wizard
- Select the boundary (No Data) polygon by clicking the white space with the selection tool
- Click the Delete key on your keyboard to delete it
Subset Low Resolution Segmentation Vector into Tiles
The purpose of this section is to separate the low resolution segmentation vector into different tiles which will be used to clip the full resolution image. We use the segmentation result from the downsampled imagery so that we can tile the full resolution image based on natural boundaries, as computed by the segmentation algorithm. This will minimize artifacts along the edges of the tiles.
- In the left pane, click on Maps tab
- Right click on the New Area branch and in the context menu select New Vector Layer…
- For Layer Type, click on the Whole Polygon radio button
- Repeat steps 2 and 3 three more times so you have four new vector layers
- Click OK
A new empty polygon vector layer has been created
- In the Maps tab, click on the lowres_seg.pix vector layer to select it
- In the Focus toolbar, make sure the Selection tool is active
- Place the mouse cursor above the middle of the top edge
- Click the left mouse button down and hold it
- Drag a bounding box down and to the left so that it approximately covers the top corner of the image
- Release the left mouse button to select all of the segmentation polygons that intersect that bounding box
- Right click anywhere on the selected polygons and in the context menu, select Cut
- In the Maps tab, right click on the New Whole Polygon Layer (empty layer) and select Paste
The selected vector polygons will have been transferred to a new vector layer and rendered as a new color
- Right click on the New Whole Polygon layer and select Save As...
- In the File Selector window, navigate to the intermediates folder and name the file UL_lowres_seg (UL = Upper Left)
- Click Save
- Click Save again on the Save As window
- In the Maps tab, uncheck the UL_lowres_seg layer to hide it
- In the Maps tab, select the lowres_seg layer
- Using the Selection tool, drag a bounding box around all of the polygons in the upper right corner to select them (best to start from the middle of the left edge of the image)
- Repeat steps 11 – 18, but for step 14 name the file UR_lowres_seg (UR = Upper Right)
- Repeat these steps for bottom right corner (name the file BR_lowres_seg) and the bottom left corner (name the file BL_lowres_seg)
When you have completed these steps for all 4 corners, you should have 4 polygon layers each of which contain the segmentation polygons for each corner
Tile Full Resolution Imagery Based on Segment Corners
This section will provide the steps required to tile your imagery along the bounds of the 4 polygon segment layers we created in the last section
- In Focus, click on the Tools dropdown menu and select Clipping/Subsetting…
- In the Input File dropdown list, select K3_20130506182405_05174_19891329_L1R_ORTHO_MS.pix
- In the Available Layers section, click on the Rasters branch to select all raster channels
- In the Define clip region section (right), change the Definition Method to Select a Clip Layer
- In the same section, click on the File dropdown list and select UL_lowres_seg.pix
- For the Bounds parameter, click on the Shape(s) Boundary radio button
- In the Output section, click Browse…
- In the File Selector, navigate to the intermediates folder
- Name the output file UL_fullres_clip
- Click Save
- Click on the Set as No Data Value checkbox
- Click Clip
- In the Define clip region section, change the File in the dropdown list to UR_lowres_seg.pix
- In the Output section, click on the output path and filename text field, scroll to the end and rename the file to UR_fullres_clip.pix
- Click Clip
- Repeat steps 13 to 15 for the remaining two corners
- When using the clip layer BR_lowres_seg.pix, make sure to name the output file BR_fullres_clip.pix
- When using the clip layer BL_lowres_seg.pix, make sure to name the output file BL_fullres_clip.pix
- Close the Clipping/Subsetting window
Segmenting Full Resolution Tiles
This section will provide the steps required to perform the segmentation of the full resolution tiles
- From the intermediates folder, open the four clipped files from the previous section into the same Focus window:
- UL_fullres_clip.pix, UR_fullres_clip.pix, BL_fullres_clip.pix, BR_fullres_clip.pix
You should have 4 uniquely clipped tiles (natural boundaries)
Note: they should all be in the same Focus window
- In Focus, click on the Analysis dropdown menu and select Object Analyst
- In the Object Analyst window, change the operation to Segmentation
- Click Select…
- In the Layer Selection window, click on the File dropdown list and select the file UL_fullres_clip.pix
- Click on the Select All button to select all channels for segmentation
- Click OK
- Change the Scale to 45
- In the Output section, click on the Browse… button
- In File Selector, navigate to the intermediates folder
- Name the file UL_seg
- Click Save
- In the Layer dropdown list, select New Layer
- Click Add and Run
Once the process completes, the segmentation layer for the upper left tile will be created and rendered in the viewer
- Select all of the boundary (No Data) polygons by clicking the white space with the selection tool
while holding down the CTRL key on your keyboard
- Click the Delete key on your keyboard to delete them
- Repeat steps 5 to 16 for the remaining 3 tiles
For step 13:
- When segmenting the UR_fullres_clip.pix, name the output UR_seg.pix
- When segmenting the BR_fullres_clip.pix, name the output BR_seg.pix
- When segmenting the BL_fullres_clip.pix, name the output BL_seg.pix
Make sure that Scale is set to 45 for all iterations
Once all segmentation processes have completed, you should be left with 4 segmentation vector layers generated at full resolution
Merge Segment Tiles Together
This section will provide the steps required to bring the segmentation polygons extracted over the 4 tiles back together into a single segmentation vector layer, so that the rest of the processing can be performed as designed.
- In the left pane, click on Maps tab
- Right click on the New Area branch and in the context menu select New Vector Layer…
- For Layer Type, click on the Whole Polygon radio button
- Click OK
A new empty polygon vector layer has been created
- In the Maps tab, right click on the BR_seg.pix layer and in the context menu, click Select All Shapes
- Repeat step 5 for the remaining *_seg.pix files so that all the segmentation layers are selected
- Right click on the selected shapes and in the context menu select Copy
- In the Maps tab, right click on the New Whole Polygon Layer and paste the selection
Once you have completed copying and pasting all of the 4 segmentation layers into the new polygon layer, your segmentation for the four corners should all be rendered in the same color
- In the Maps tab, right click on the New Whole Polygon Layer that you just copied all 4 segmentation tiles to and select Save As…
- Click Browse..
- In File Selector, navigate up one level to the folder OA_LargeFileClassification
- Name the file full_segmentation
- Click Save in the File Selector
- Click Save in the Save As window
Continue Regular Object Classification Workflow
At this point you can continue the Object Analyst workflow starting with Feature Extraction, using the full_segmentation.pix layer as your input Segmented Vector Layer and the channels from the K3_20130506182405_05174_19891329_L1R_ORTHO_MS.pix file as the Source Channels.
See our Object Analyst Classification tutorial for the remaining steps in the Classification workflow.
Comments