AUTOCUT

Automatic cutline generation


EnvironmentsPYTHON :: EASI
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Example :: Related

Back to top

Description


AUTOCUT reads an image and a partially computed mosaic and computes an optimal cutline for adding the image to the mosaic. The resulting cutline is stored as vector segment in the image file. To insert the image into the mosaic, use the MOSAIC program.
Back to top

Parameters


autocut(file1, dbic1, file2, dbic2, dbvs, cfunc)

Name Type Caption Length Value range
FILE1 * str Input file name 1 1 -    
DBIC1 * List[int] Input channel list 1 1 - 1  
FILE2 * str Input file name 2 1 -    
DBIC2 * List[int] Input channel list 2 1 - 1  
DBVS List[int] Output vector segment 0 - 1  
CFUNC str Cost function 0 - 4 DIFF, GRAD, COMB
Default: DIFF

* Required parameter
Back to top

Parameter descriptions

FILE1

Specifies the file containing the current mosaic into which the new image is to be added.

DBIC1

Specifies the channel within FILE1 that contains the image mosaic. This must be an 8-bit channel.

FILE2

Specifies the file containing the new image to be added to the mosaic. A vector segment containing an optimal cutline will be created in FILE2. The image can be added to the mosaic using the MOSAIC program.

DBIC2

Specifies the channel within FILE1 that contains the new image data.

DBVS

Specifies the vector segment to which the cutline will be written. If this parameter is not specified, a new segment is created.

CFUNC

Specifies the cost function with which the cutline will be computed.

Acceptable values are:
Back to top

Details

AUTOCUT reads the region(s) of overlap between an image and an existing partial mosaic, and computes an optimal polygonal cutline for the new image.

The polygonal cutline is saved as a single vector in an output vector segment. The polygon consists of one or several cutlines through the overlap regions of two images. Two endpoints are selected for each region of overlap; these are the two points on the boundary of the existing mosaic at which the boundary of the new image intersects. In the region of overlap, a line joining the two endpoints is computed by optimizing the cost function over all possible paths (within a certain level of complexity). The cutline is able to change direction to avoid "bad" regions. In regions of the new image where no overlap exists, the boundary of the new image is taken as the cutline. The resulting vector segment joins all the computed cutlines into a single boundary within which all pixels in the new image will be placed in the mosaic.

The cost function DIFF is defined as the difference in gray-tone between corresponding pixels of the new image and existing mosaic. The cost function GRAD is defined as the smaller of the two local slopes, one in each image, at corresponding pixels. The cost function COMB is a hybrid that combines both DIFF and GRAD cost functions.

To produce an entire mosaic, the first image can be added to the mosaic file directly using MOSAIC. Cutlines for the next image are computed using AUTOCUT, and the mosaic is then updated with the appropriate sections of the new image using MOSAIC. This process is repeated until all the images are added.

The order in which the images are mosaicked will affect the cutlines that are selected. A typical strategy for ordering the images is to enter them into the mosaic in "flight-line" order, beginning from one corner of the mosaic region.

The two input files must have matching geocoding, with the same pixel sizes.

The value 0 is considered to be background, and is ignored in both the new image and the existing mosaic image.

Back to top

Example

Compute cutline for channel 1 of "DATA.PIX" for insertion into the mosaic in channel 2 of "MOSAIC.PIX". Use the gradient cost function, and produce a new output vector segment in "DATA.PIX".

from pci.autocut import autocut

file1 = "MOSAIC.PIX"
dbic1 = [2]
file2 = "DATA.PIX"
dbic2 = [1]
dbvs = []
cfunc = "GRAD"

autocut( file1, dbic1, file2, dbic2, dbvs, cfunc )

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.