SELFCAL

Refines tie points and ground control points with camera self-calibration


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

Back to top

Description


SELFCAL refines tie points (TP) and ground control points (GCP) in a CATALYST Professional OrthoEngine project file. Camera self calibration is performed using the TP's and the camera model in the project file is updated.
Back to top

Parameters


selfcal(oeproji, oeprojo, focalmm, chipmm, gcpres, tpres, pointopt, mintp, sample, sampletp, calopt, imstat)

Name Type Caption Length Value range
OEPROJI * str Input OrthoEngine project file 1 -    
OEPROJO * str Output OrthoEngine project file 1 -    
FOCALMM List[float] Focal length (mm) 0 - 1 0.1 - 500
CHIPMM List[float] Chip Size in (mm) 0 - 2 0.1 - 100
GCPRES List[float] Maximum GCP residual 0 - 1 0.1 - 1000
TPRES List[float] Maximum TP residual 0 - 1 0.1 - 1000
POINTOPT * str Options for rejected points 3 -   INACT | DEL
Default: INACT
MINTP List[int] Minimum number of TPs 0 - 1  
SAMPLE List[int] Sample Count 0 - 1  
SAMPLETP List[int] Sample Count TP 0 - 1  
CALOPT str Options for processing. 0 -    
IMSTAT List[float] Output SELFCAL statistics 0 -    

* Required parameter
Back to top

Parameter descriptions

OEPROJI

The path and file name of the OrthoEngine project file (*.prj) containing the points you want to refine.

OEPROJO

The path and file name of the output OrthoEngine project file to which to write the refined TPs, GCPs, or both.

You can specify your input project as your output project; however, by doings so, the input file will be overwritten with the new information.

FOCALMM

Option to specify focal length. If focal length is not specified, the program will try to extract it from the project file or image's EXIF tag.

CHIPMM

Option to specify sensor chip width and height in mm If the values are not specified, the program will try to extract it from the project file or the image's EXIF tag.

GCPRES

The maximum residual for x and y per GCP.

For example, to refine the OrthoEngine project until all GCPs have a residual of two or less in both the x and y direction, enter 2.

TPRES

The maximum residual for x and y per TP.

For example, to refine the OrthoEngine project until all TPs have a residual of two or less in both the x and y direction, enter 2.

POINTOPT

The disposition of the rejected points.

That is, on completion of refinement, you can elect to either render the rejected points inactive (INACT) or delete (DEL) them.

MINTP

The minimum number of TPs per image.

Images with fewer than the minimum number of TPs before and after refinement will be rendered inactive.

SAMPLE

Optionally to specify the number of photos used for camera self-calibration. A minimum value of 100 is recommended.

SAMPLETP

Optionally to specify the maximum number of TPs must exist in SAMPLE photos. If it does not meet the requirement, SELFCAL would call TIEIMAGE to generate TPs based on SAMPLETP to achieve the target.

CALOPT

Self-calibration options. Multiple options can be specified.

IMSTAT

On completion of processing, SELFCAL updates IMSTAT with information that may be useful in a scripting environment, as follows:
Back to top

Return Value

Returns: Execution status

Type:  PCI_INT

The return value is 0. This function returns only if it executes successfully; otherwise, it throws an exception.

Back to top

Details

SELFCAL performs self calibration using TP's, updates the camera model in the project file, and then refines TPs and GCPs in the OrthoEngine project file using the new camera model.

The algorithm removes points in either a progressive or direct mode according to the specified residual. In progressive mode, large residuals are removed in the following steps:
  1. Remove residuals greater than 1,000 pixels
  2. Remove residuals greater than 500 pixels
  3. Remove residuals greater than 100 pixels
  4. Remove residuals greater than 20 pixels
  5. Remove residuals greater than 10 pixels
  6. Remove residuals according to the specified residual

In direct mode, the specified residual is applied exclusively.

Processing is complete when the specified residual is reached.

Back to top

Example

In the following example, TPs and GCPs are designated inactive until the x and y residual for each meets the specified GCP and TP residual.

from pci.selfcal import selfcal

oeproji = "uav.prj"
oeprojo = "uav_out.prj"
focalmm = []  #Option to specify focal length in mm if it cannot be extracted from EXIF tag 
chipmm = []   #Option to specify X and Y chip size in mm if it cannot be extracted from EXIF tag 
gcpres = []   #Option to refine until remaining GCPs have an x-residual and a y-residual under gcpres
tpres = [2.0] #Refine until remaining TPs have an x-residual and a y-residual under 2
pointopt = "inact" #Designate refined points inactive
mintp = [10] #Designate images with fewer than 10 TPs inactive
sample = []  #Option to use only sample number of images for self-calibration to speed up processing
sampletp = [] #Option to set the minimum number of TPs for each sample image.
calopt = "" #Self calibration option
imstat = [] #Selfcal results 

selfcal (oeproji, oeprojo, focalmm, chipmm, gcpres, tpres, pointopt, mintp, sample, 
         sampletp, calopt, imstat)

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