REGPRO

Image registration and projection


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

Back to top

Description


Performs registration of an input image to an output image.
Back to top

Parameters


regpro(fili, ingeo, dbic, dbgc, filo, outgeo, dboc, resample, order, sampling, mask, memsize)

Name Type Caption Length Value range
FILI * str Input file name 1 -    
INGEO List[int] Input georeference segment 0 - 1 1 -
Default: 1
DBIC * List[int] Input raster image channels 1 -    
DBGC List[int] Input GCP segment 0 - 1  
FILO str Output file name 0 -    
OUTGEO List[int] Output georeference segment 0 - 1 1 -
Default: 1
DBOC * List[int] Output raster image channel(s) 1 -    
RESAMPLE str Resampling method 0 - 5 NEAR | BILIN | CUBIC | 8PT | 16PT
Default: NEAR
ORDER List[int] Order of polynomial equation 0 - 1 -1 - 5
Default: 0
SAMPLING List[int] Sampling interval 0 - 1 1 - 10
Default: 1
MASK List[int] Area mask (bitmap or window) 0 - 4 Xoffset, Yoffset, Xsize, Ysize
MEMSIZE List[int] Working memory size (MB) 0 - 1 0 -
Default: 16

* Required parameter
Back to top

Parameter descriptions

FILI

Specifies the name of the input image file that contains the uncorrected image data and the GCP segment.

INGEO

Specifies the input georeference segment that contains projection information and bounds for FILI.

DBIC

Specifies the image channels from the input file (FILI) to correct.

Duplicate channels are NOT allowed.

DBGC

Specifies the segment from the input file (FILI) that contains the ground control points (GCPs). Elevation values are ignored during the correction process.

The ground control segment is used to generate the polynomial transformation, allowing the uncorrected data to be mapped to a corrected form. If the GCP segment output units are 'PIXEL', this function will use this direct transformation to produce the corrected image.

If the GCP segment output units are not 'PIXEL', they must be converted to 'PIXEL'. This may be done if the GCP segment output units are the same as the output units of the bounds defined in the corrected image's georeferencing segment. The output units and bounds may be defined for the corrected image database using GEOSET prior to running REGPRO.

If no GCP segment is specified, REGPRO will either generate GCPs (if ORDER is 1 to 5) or transform by projection (if ORDER is 0). If either of these options is used, it is assumed that FILI and FILO have already been corrected to overlay the georeference base projection and that their georeference information has been set using the INGEO and OUTGEO parameters.

FILO

Specifies the name of the output file to receive the corrected image data. This file must already exist before running REG.

If this parameter is not specified, it is assumed that FILI and FILO are the same.

OUTGEO

Specifies the georeference segment to contain projection information and bounds for FILO.

DBOC

Specifies the channels in the output file (FILO) to receive the corrected image data.

Duplicate channels are NOT allowed.

Note: For each channel specified in this parameter, a corresponding output channel must be specified in DBOC.

RESAMPLE

Specifies the resampling method to use during the registration process.

The following methods are supported:

ORDER

Specifies the ORDER to use for the regression model that will fit uncorrected-to-corrected GCP coordinates.

Supported values are:

If no GCP segment is defined, the transformation is performed using the projection information and image bounds defined by the INGEO and OUTGEO parameters. If the order is in the range of 1 to 5, this is the order of the transform used and 256 GCPs are generated using the projection information in INGEO and OUTGEO. The RMS for the generated GCPs is verified and, if greater than 0.5 pixels or lines, the reprojection continues but a warning is printed. This may happen when FILO is for large areas of the earth surface, in which case it would be better to rerun REGPRO with ORDER=0 or with an ORDER value greater than the value specified when the warning was issued.

If no GCP segment is defined and ORDER=0, REGPRO uses the projection information in INGEO and OUTGEO to correct FILI to the FILO projection. Although this option may require more processing time, as REGPRO performs a conversion between the FILI and FILO projections for every pixel in the image, rather than rubber-sheeting between GCPs, is the most accurate means.

Note: If there are less than the minimum number of GCPs for the specified ORDER, REGPRO issues an error message and exits.

To obtain good results, it is best to have two or three times the minimum number of GCPs for a particular ORDER (for example, 12 to 18 GCPs for 2nd ORDER) and the GCPs should be evenly distributed over the entire uncorrected image.

SAMPLING

Optionally specifies the sampling interval used to calculate the reprojection position. Conversion between projections is a very time-consuming process; to speed up the process, instead of calculating the reprojected position for each point, you may calculate the reprojected position for every sampling point and linearly interpolate the positions in between. For example, in most cases, a sampling interval of 4 can reduce the processing time by 50% while preserving the same level of accuracy. The default sampling interval is 1.

MASK

Specifies the window or bitmap that defines the area to be processed within the input raster.

If a single value is specified, that value represents the channel number of the bitmap segment in the output file. Only the pixels under the bitmap are processed; the rest of the image remains unchanged.

If four values are specified, they define the x,y offsets and x,y dimensions of a rectangular window identifying the area to process. Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.

If no value is specified, the entire channel is processed.

MEMSIZE

Specifies the amount, in megabytes, of internal memory allocated to REGPRO.

The default is 16 MB; a typical amount of memory to allocate is approximately half of the RAM available on the system.

Back to top

Details

REGPRO performs registration of an input (uncorrected) image to an output (master) image.

Registration is the process of transforming/warping one set of image data (usually called the uncorrected image) to register with a second set of data (usually called the corrected or master image). After registration, the two image sets will have the same scale, rotation, etc. and the previously uncorrected image will fit over the master image.

Selected input image channels (DBIC) are registered/corrected using a 5th (or lower) order polynomial transformation, based on ground control points in a specified GCP segment (DBGC). The registered image is stored in the defined output image channels (DBOC) of an output file (FILO). The GCP segment must exist in the input file.

The ground control points used for registration must be acquired using one of the various ground control point acquisition tasks available. (See the documentation for GCPREP for a description of the registration model and how to obtain a report of the specific model that will be used by REGPRO).

REGPRO only outputs actual resampled pixels to the output channels (DBOC). While this allows mosaicking of more than one image into the same channels, it does require the user to CLEAR the channels initially (see CLR).

If the input ground control point segment (DBGC) is not defined, the resampling is performed using the projection information and georeference bounds stored in the INGEO parameter to convert to the projection and bounds stored in the OUTGEO parameter. For such a case, it is assumed that the two images have already been registered to overlay the georeference base projection and bounds. If FILI has not already been corrected to a projection, it should first be corrected using a GCP segment (DBGC). If INGEO or OUTGEO are defaulted, they are assumed to be segment 1 of the input/output file.

If DBGC is not defined and ORDER is in the range of 1 to 5, the image correction is performed by generating 256 GCPs between the two systems and rubber-sheeting between the GCPs.

If DBGC is not defined and ORDER = 0, the image transform will be by conversion between projections rather than rubber-sheeting (distorting a layer to allow it to be seamlessly joined to an adjacent geographic layer of matching imagery) between GCPs. This option may require more processing time, as the conversion is done between projections for every pixel in the output image, but the results will be as accurate or better than by rubber-sheeting with GCPs. Similar results may be achieved in less time by running REGPRO with ORDER=2 or ORDER=3 and generating GCPs.

The RMS for the generated GCPs is verified and, if greater than 0.5 pixels or lines, the reprojection continues but a warning is printed. This may happen when FILO is for large areas of the earth surface, in which case it would be better to rerun REGPRO with ORDER=0 or with an ORDER value greater than the value specified when the warning was issued.

For more detailed information, see the Details section in the REG online help.

Back to top

Examples

GCP segment 27 on "irvine.pix" ties down "irvine.pix" to "eltoro.pix". Because both "irvine.pix" and "eltoro.pix" have already been geometrically corrected to overlay the "UTM 11 S E000" projection, "irvine.pix" can be automatically geometrically transformed to overlay "eltoro.pix". The following three examples produce similar results.

First, create three new channels on "eltoro.pix" to receive the output imagery.

Note: If either FILI or FILO have not been corrected to overlay their georeference base projection, REGPRO should only be run as in Example 1 with an input GCP segment. Examples 2 and 3 should be run only if the FILI and FILO imagery have already been corrected to overlay their georeference base projection.
from pci.pcimod import pcimod
from pci.clr import clr

file	=	'eltoro.pix'
pciop	=	'ADD'
pcival	=	[3]

pcimod( file, pciop, pcival )

file	=	'eltoro.pix'
dboc	=	[2,3,4]
valu	=	[0,0,0]
dbow	=	[]

clr( file, dboc, valu, dbow )

Transform by projections; that is, no rubber-sheeting between GCPs.

from pci.regpro import regpro

fili	=	'irvine.pix'	# input file name
ingeo	=	[]	# default segment 1 on FILI
dbic	=	[4]
dbgc	=	[]	# no GCP input segment
filo	=	'eltoro.pix'
outgeo	=	[]	# default segment 1 on FILO
dboc	=	[4]	# overwite input
resample	=	'CUBIC'
order	=	[0]	# no rubber-sheeting between GCPs
sampling	=	[]
mask	=	[]
memsize	=	[]

regpro( fili, ingeo, dbic, dbgc, filo, outgeo, dboc, resample,
        order, sampling, mask, memsize )

Rubber-sheeting with generated GCPs.

from pci.regpro import regpro

fili	=	'irvine.pix'	# input file name
ingeo	=	[]	# default segment 1 on FILI
dbic	=	[4]
dbgc	=	[]	# generate GCPs
filo	=	'eltoro.pix'
outgeo	=	[]	# default segment 1 on FILO
dboc	=	[3]
resample	=	'CUBIC'
order	=	[2]	# 2nd order transform, generate 256 GCPs
sampling	=	[]
mask	=	[]
memsize	=	[]

regpro( fili, ingeo, dbic, dbgc, filo, outgeo, dboc, resample,
        order, sampling, mask, memsize )

Rubber-sheeting with input GCPs.

from pci.regpro import regpro

fili	=	'irvine.pix'	# input file name
ingeo	=	[]
dbic	=	[4]
dbgc	=	[27]	# GCP segment 27
filo	=	'eltoro.pix'
outgeo	=	[]	# default segment 1 on FILO
dboc	=	[2]
resample	=	'CUBIC'
order	=	[2]	# 2nd order transform, from input GCPs
sampling	=	[]
mask	=	[]
memsize	=	[]

regpro( fili, ingeo, dbic, dbgc, filo, outgeo, dboc, resample,
        order, sampling, mask, memsize )

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