GCPCAND

Candidate generation for automatic GCP collection


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

Back to top

Description


GCPCAND processes reference images to generate candidates for automatic collection of ground control points (GCP).
Back to top

Parameters


gcpcand(mfile, dbic, srcbgd, loclmask, smplsrc, distrib, distnum, trials, proc, filo)

Name Type Caption Length Value range
MFILE * str Input file name, folder, or text file 1 -    
DBIC List[int] Reference image channel(s) 0 -    
SRCBGD str Source background value 0 -   Default: FILE
LOCLMASK str Local exclusion mask 0 -   Default: NONE
SMPLSRC str Candidate samples source 0 -   SUSAN | GRID
Default: GRID
DISTRIB str Distribution unit 0 -   MAPSPACING | PIXELSPACING | ENTIRE
Default: MAPSPACING
DISTNUM str Distribution number 0 -    
TRIALS List[int] Number of trials per candidate 0 - 1 1 - 8
Default: 1
PROC str Processing algorithm 0 -  
FILO str Output file or folder 0 -    

* Required parameter
Back to top

Parameter descriptions

MFILE

The name of a folder, image file, or text file that contains the reference images from which to produce candidates. If necessary, you can use a wildcard (*) in the string.

You can specify the value of the MFILE parameter by using any of the following:
If the text file option is used, the following general rules apply:

If the MFILE you specify does not have a list of channels to process, the value of the DBIC (Input Channels) parameter is used.

When specifying file channels, you can specify individual channels or channel sequences. An individual channel index is a single positive integer (for example, "1"). A channel sequence is a positive integer followed by a comma and a negative number (for example, "1,-3"). In this example, "1,-3" means to process channels 1 through 3 inclusive; it is expanded internally to "1,2,3". The second channel number in the sequence must be greater than the first channel number.

If the MFILE you specify does not have the source background specification, the value of the SRCBGD parameter is used.

DBIC

The channel or channels in the reference-image file from which to extract the SUSAN corner features when using the SUSAN detector. When there are multiple channels, they are averaged together.

If the value of the DBIC parameter is in a text file (MFILE), this parameter is ignored.

If no value is specified for this parameter, the first channel is processed by default.

This parameter is ignored when the value of the SMPLSRC (Candidate samples source method) parameter is any option other than SUSAN.

SRCBGD

The pixels in the source image to consider as background (NoData) pixels. In general, if a pixel is considered NoData, GCPCAND processes the pixel in a specific manner.

You can choose from the following options:
Note: To specify multiple values, use a comma-delimited list. The first value applies to the first channel, the second value to the second channel, and so on. If fewer values are specified than the number of input channels, the last value is repeated for all remaining channels. If more values are specified than the number of input channels, the extra values are ignored. This parameter is ignored when the value of the SMPLSRC (Candidate samples source method) parameter is any option other than SUSAN.

LOCLMASK

Specify whether to apply a local mask to prevent points from being collected in those locations. If no value is specified for this parameter (default), or you specify a value, but one or more of the images do not contain a bitmap or vector segment, no local exclusion mask will be applied for those images.

The syntax for LOCLMASK is:
LOCLMASK = (NONE | BIT | VEC | <n>)
You can specify the value of LOCLMASK using the following:

This parameter is optional.

SMPLSRC

The source of sample points for the candidates

If no value is specified for this parameter, GRID is used by default.

The SUSAN and GRID options determine how to find the candidate positions in the reference image. AutoGCP will attempt to collect GCPs at these locations.

When collecting GCPs, the GRID option is preferred, because the SUSAN option finds candidates on building corners that may not be represented in the digital elevation model (DEM), leading to GCPs with higher residuals due to height errors.

DISTRIB

The unit of value to use for the DISTNUM parameter.

You can choose from the following options:

DISTNUM

This controls the number of GCPs to find, in the units specified for the DISTRIB (Distribution) parameter. The default value generally produces approximately 100 points evenly distributed over the reference image. When the value of the DISTRIB (Distribution) parameter is MAPSPACING, and the reference image has a projection in degrees, you can specify a string in the format degrees-minutes-seconds. The specific format is as follows:

TRIALS

The number of trials per candidate. Trials are backup candidates to try when the main candidate failed to match a given raw image. When there is an insufficient number of stereo GCPs, it is recommended that you use a denser distribution rather than more trials, as the backup trials are only collected if the main candidate failed to match for a particular image.

PROC

The amount of memory (in megabytes) used by GCPCAND.

If the host memory limit is not specified, the function uses a default of 1 gigabyte (GB) or half the available physical memory, whichever is less.

FILO

The name of the output file or folder to which to write the processed files, depending on the value of the MFILE parameter:

The vector segment GCPCAND creates will be named GCPCand and have a description of GCP candidate points.

Back to top

Return Value

Returns: Vector segment number

Type:  PCI_INT

Parameter: LASC

The segment number of the newly created vector segment is returned. When you have multiple input files, the segment number corresponds to the vector segment number in the last image.

When called from EASI, the return value is written to the LASC parameter in the PRM file.

This function returns a result only if it runs successfully; otherwise, processing stops, and an error message is displayed.

Back to top

Details

GCPCAND generates candidates for automatic GCP collection by preprocessing reference images and writing a vector segment containing the generated candidates to a file. These candidates can be used by AUTOGCP to collect GCPs. The vector segment created by GCPCAND will be named GCPCand and have a description of GCP candidate points.

Back to top

Example

The following example finds GCPs for an input image called "spotRaw.pix".

from pci.gcpcand import gcpcand

mfile = u"SPOT_MOSAIC.PIX" 
dbic = []      # Integer
srcbgd = u"" 
loclmask = ""
smplsrc = u"GRID" 
distrib = u"PIXELSPACING" 
distnum = u"1000"
trials = [1]      # Integer
proc = u"" 
filo = u"cSPOT_MOSAIC.PIX" 

try:
    gcpcand(mfile, dbic, srcbgd, loclmask, smplsrc, distrib, distnum, trials, proc, filo)
except Exception as e:
    print(e)

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