Take me to pcigeomatics.com

PCI Geomatics Help Center

How can we help you today?

Large File Segmentation

PCI Geomatics -

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

311 MB

314 MB

342 MB

399 MB

2000 x 2000

959 MB

965 MB

1.06 GB

1.24 GB

3000 x 3000

2.02 GB

2.07 GB

2.29 GB

2.66 GB

4000 x 4000

3.49 GB

3.61 GB

3.98 GB

4.63 GB

5000 x 5000

5.42 GB

5.59 GB

6.18 GB

7.19 GB

6000 x 6000

7.72 GB

7.99 GB

8.86 GB

10.3 GB

7000 x 7000

10.5 GB

10.9 GB

12.0 GB

14.0 GB

8000 x 8000

13.7 GB

14.2 GB

15.7 GB

18.2 GB

9000 x 9000

17.2 GB

17.9 GB

19.8 GB

23.0 GB

10000 x 10000

21.2 GB

22.1 GB

24.3 GB

28.0 GB

*Image Size = Rows x Columns (pixels)

**Peak Memory usage for number of image bands shown

 

Note: The file size restriction is a known limitation and will be addressed as soon as possible

 

Options for Handling Large Imagery in Object Analyst

  1. 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
  2. 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-s96218f3d85a402f8

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

www.GetGeomatica.com

 

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

  1. Navigate to D:\Projects\Marketing\G2017_release_matreial\tutorial\OA_LargeFileClassification\Input and locate the K3_20130506182405_05174_19891329_L1R_ORTHO_MS.pix file
  2. 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)

image001.png

  1. Click on the Files tab in the layer and files manager on the left side of Focus
  2. Right click on the image file K3_20130506182405_05174_19891329_L1R_ORTHO_MS.pix and in the context menu, select Properties

image003.png

  1. 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 10.8525GB and 14.174GB

*Image Size

3 Bands

4 Bands

7 Bands

12 Bands

1000 x 1000

311 MB

314 MB

342 MB

399 MB

2000 x 2000

959 MB

965 MB

1.06 GB

1.24 GB

3000 x 3000

2.02 GB

2.07 GB

2.29 GB

2.66 GB

4000 x 4000

3.49 GB

3.61 GB

3.98 GB

4.63 GB

5000 x 5000

5.42 GB

5.59 GB

6.18 GB

7.19 GB

6000 x 6000

7.72 GB

7.99 GB

8.86 GB

10.3 GB

7000 x 7000

10.5 GB

10.9 GB

12.0 GB

14.0 GB

8000 x 8000

13.7 GB

14.2 GB

15.7 GB

18.2 GB

9000 x 9000

17.2 GB

17.9 GB

19.8 GB

23.0 GB

10000 x 10000

21.2 GB

22.1 GB

24.3 GB

28.0 GB

 

  1. Open up the properties window for your computer
  2. Verify whether you have enough memory on your PC to process this image as is or whether you need to tile the image

My System only has 8GB of memory, which will not be enough to process this image as is. Therefore, I will have to either downsample the image or tile it. Since the purpose of this tutorial is to demonstrate a technique for tiling that minimizes edge artifacts in the segmentation layer, we will proceed with the latter method.

image005.png

 

 

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.

  1. In the Focus dropdown menu bar, click on Tools > Algorithm Librarian
  2. In Algorithm Librarian, click on the Find… button
  3. In the Find Algorithm window, type resamp and click Find Next
  4. Double click on the RESAMP algorithm in the Algorithm Librarian window to open it

image007.png

  1. 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)
  2. Select the four image channels

image009.png

  1. At the bottom in the Output Ports section, click on Browse…
  2. 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
  3. Click Save
  4. At the top of the RESAMP Module Control Panel, click on the Input Params 1 tab
  5. Set both the Output Pixel X Size and Output Pixel Y Size parameters to 5.6 (2x coarser than full resolution)

image011.png

  1. 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.

image013.png

  1. Close the RESAMP Module Control Panel, the Find Algorithm and Algorithm Librarian windows
  2. In Focus, click on the Analysis dropdown menu and select Object Analyst
  3. In the Object Analyst window, click on the Operation dropdown list and select Segmentation
  4. In the Source Image Layers section, click on the Select… button
  5. In the Layer Selection window, click on the File dropdown list and select the resamp_k3.pix image
  6. Click on the Select All button

image015.png

  1. Click OK
  2. In the Parameters section, change the Scale to 250
  3. In the Output section, click Browse…
  4. In File Selector, navigate to the intermediates folder and name the file lowres_seg
  5. Click Save
  6. In the Layer dropdown list, select New Layer

image017.png

  1. Click the Add and Run button image019.png

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

image021.png

  1. Close the Object Analyst wizard
  2. Select the boundary (No Data) polygon by clicking the white space with the selection tool image023.png
  3. Click the Delete key on your keyboard to delete it

Capture.JPG

 

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.

  1. In the left pane, click on Maps tab

image030.png

  1. Right click on the New Area branch and in the context menu select New Vector Layer…
  2. For Layer Type, click on the Whole Polygon radio button
  3. Repeat  steps 2 and 3 three more times so you have four new vector layers
  4. Click OK

A new empty polygon vector layer has been created

image032.png

  1. In the Maps tab, click on the lowres_seg.pix vector layer to select it
  2. In the Focus toolbar, make sure the Selection tool is active

image034.png

  1. Place the mouse cursor above the middle of the top edge

image037.png

  1. Click the left mouse button down and hold it
  2. Drag a bounding box down and to the left so that it approximately covers the top corner of the image

image039.png

  1. Release the left mouse button to select all of the segmentation polygons that intersect that bounding box

image041.png

  1. Right click anywhere on the selected polygons and in the context menu, select Cut

image043.png

  1. In the Maps tab, right click on the New Whole Polygon Layer (empty layer) and select Paste

image045.png

The selected vector polygons will have been transferred to a new vector layer and rendered as a new color

  1. Right click on the New Whole Polygon layer and select Save As...
  2. In the File Selector window, navigate to the intermediates folder and name the file UL_lowres_seg (UL = Upper Left)
  3. Click Save
  4. Click Save again on the Save As window
  5. In the Maps tab, uncheck the UL_lowres_seg layer to hide it
  6. In the Maps tab, select the lowres_seg layer

image053.png

  1. 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)

Capture1.JPG

  1. Repeat steps 11 – 18, but for step 14 name the file UR_lowres_seg (UR = Upper Right)
  2. 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

image057.png

 

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

  1. In Focus, click on the Tools dropdown menu and select Clipping/Subsetting…
  2. In the Input File dropdown list, select K3_20130506182405_05174_19891329_L1R_ORTHO_MS.pix
  3. In the Available Layers section, click on the Rasters branch to select all raster channels

image059.png

  1. In the Define clip region section (right), change the Definition Method to Select a Clip Layer
  2. In the same section, click on the File dropdown list and select UL_lowres_seg.pix
  3. For the Bounds parameter, click on the Shape(s) Boundary radio button

image061.png

  1. In the Output section, click Browse…
  2. In the File Selector, navigate to the intermediates folder
  3. Name the output file UL_fullres_clip
  4. Click Save
  5. Click on the Set as No Data Value checkbox

image063.png

  1. Click Clip
  2. In the Define clip region section, change the File in the dropdown list to UR_lowres_seg.pix

image065.png

  1. 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

image067.png

  1. Click Clip
  2. 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
  1. 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

  1. 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

Capture2.JPG

  1. In Focus, click on the Analysis dropdown menu and select Object Analyst
  2. In the Object Analyst window, change the operation to Segmentation
  3. Click Select…
  4. In the Layer Selection window, click on the File dropdown list and select the file UL_fullres_clip.pix

image077.png

  1. Click on the Select All button to select all channels for segmentation
  2. Click OK
  3. Change the Scale to 45
  4. In the Output section, click on the Browse… button
  5. In File Selector, navigate to the intermediates folder
  6. Name the file UL_seg
  7. Click Save
  8. In the Layer dropdown list, select New Layer

image079.png

  1. Click Add and Run image081.jpg

Once the process completes, the segmentation layer for the upper left tile will be created and rendered in the viewer

  1. Select all of the boundary (No Data) polygons by clicking the white space with the selection tool image082.jpg while holding down the CTRL key on your keyboard

image083.png

  1. Click the Delete key on your keyboard to delete them

image085.png

  1. 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

image087.png

 

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.

  1. In the left pane, click on Maps tab

image091.jpg

  1. Right click on the New Area branch and in the context menu select New Vector Layer…
  2. For Layer Type, click on the Whole Polygon radio button
  3. Click OK

A new empty polygon vector layer has been created

image092.jpg

  1. In the Maps tab, right click on the BR_seg.pix layer and in the context menu, click Select All Shapes

image093.png

  1. Repeat step 5 for the remaining *_seg.pix files so that all the segmentation layers are selected
  2. Right click on the selected shapes and in the context menu select Copy

image095.png

  1. In the Maps tab, right click on the New Whole Polygon Layer and paste the selection

image097.png

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

image099.png

 

  1. 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…
  2. Click Browse..
  3. In File Selector, navigate up one level to the folder OA_LargeFileClassification
  4. Name the file full_segmentation
  5. Click Save in the File Selector
  6. 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.

image101.png

See our Object Analyst Classification tutorial for the remaining steps in the Classification workflow.

Have more questions? Submit a request

Comments

Powered by Zendesk