CAMIMPORT

Import camera-calibration parameters


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

Back to top

Description


CAMIMPORT imports camera-calibration parameters from an Extensible Markup Language (XML) or Pix4D (.cam) file into a CATALYST Professional OrthoEngine project file.
Back to top

Parameters


camimport(oeproji, tfile, oeprojo)

Name Type Caption Length Value range
OEPROJI * str Input OrthoEngine project file 1 -    
TFILE * str Input text file 1 -    
OEPROJO * str Output OrthoEngine project file 1 -    

* Required parameter
Back to top

Parameter descriptions

OEPROJI

The input OrthoEngine project file to which to write the camera-calibration information.

TFILE

The name of the input XML or Pix4D file that contains the camera-calibration information.

For more information about the camera-calibration file, see Details.

OEPROJO

The name of a OrthoEngine project file to create, and which to write the contents of the input project file and camera-calibration information read from the input XML file.

If the output project file is the same as the input project file then CAMIMPORT will update the input project file.

If the output project file exists, CAMIMPORT, an error message will be displayed in the log.

Back to top

Return Value

Returns: Execution status

Type:  PCI_INT

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

Back to top

Details

CAMIMPORT imports camera-calibration parameters from an XML file into an OrthoEngine project file.

About camera calibration

The camera-calibration information is used to identify and correct any distortions introduced in the image due to any of the following:
  • Curvature of the lens
  • Focal length of the lens
  • Effects of perspective

The information is used to compute the interior orientation, which defines the geometry of the camera. The geometry is used to reconstruct a bundle of rays from a set of image points.

Camera-calibration report

Typically, images acquired with a photogrammetric-aerial camera include a calibration report that provides information about the camera. If images from the camera do not include a report, you can obtain one from the camera manufacturer or from a company that calibrates cameras of the type you have.

The camera-calibration report typically includes the information described in the following table.

Parameter Description Required for scanned-film* Required for digital / UAV
Camera name Name of the camera used to acquire the imagery.    
Focal length Distance between the focal point of the lens and the film.

Focal length

Note: Entering an incorrect focal length can introduce distortions in a project.
Principal point of symmetry Point on the image at which a ray of light that travels perpendicular to the image plane passes through the focal point of the lens and intersects the film.

With a correctly assembled camera, the principal point of symmetry is where the lines of opposing fiducial marks on an image intersect. With most cameras, however, a slight offset occurs typically. The perspective effects in the image are radial about this point. The offsets are typically specified in the camera-calibration report and are referred to as the point of symmetry or the calibrated principal point.

   
Radial-lens distortion Symmetric distortion due to imperfections in the curvature of the lens during manufacturing.

Typically, errors introduced by a radial-lens distortion (ranging from approximately 1 um through 2 um) are much smaller than the scanning resolution of the image (approximately 25 um). Entering the values can significantly increase the processing time while contributing little to the final product. Values for the radial-lens distortion can be provided as ranging from R0 through R7 coefficients or in a tabular format.

The equation for the lens distortion is as follows:
  • delta-r = R0 + R1 × r + R2 × r2 + R3 × r3 + R4 × r4 + R5 × r5 + R6 × r6 + R7 × r7
Where:
  • r is the radial distance from the center of the image
  • R0 through R7 are the radial-distortion coefficients

If you use a camera-calibration report from the U.S Geological Survey (USGS), the coefficients are given as K0, K1, K2, K3, and K4, which correspond to R1, R3, R5, and R7. K4 is discarded because it is usually zero. The coefficients may or may not appear in the camera-calibration report.

It is recommended that with a digital camera you obtain the radial-distortion values. That is, radial distortion with digital cameras and their lenses tends to be greater, because their precision of manufacture tends to be inferior to that of high-end photogrammetric cameras.

   
Decentering distortion Nonsymmetric distortion caused by the misalignment of the lens elements when the camera is assembled.

The decentering-distortion values can be provided ranging from P1 through P4 coefficients or in tabular format.

The equation for decentering distortion is as follows:
  • delta-x = (1 + P3r2 + P4r4 ...) (P1 (r2 + 2 × 2) + 2P2xy)
  • delta-y = (1 + P3r2 + P4r4 ...) (2P1xy + P2(r2 + 2y2)
Where:
  • x is the x-coordinate of a given image point
  • y is the y-coordinate of a given image point
  • Pn is the decentering-distortion coefficients
  • delta-x is the distortion of an image point at x and y in the x-axis
  • delta-y is the distortion of an image point at x and y in the y-axis

The coefficients may or may not appear in the camera-calibration report.

It is recommended that with a digital camera you obtain the decentering-distortion values. That is, decentering distortion with digital cameras and their lenses tends to be greater, because their precision of manufacture tends to be inferior to that of high-end photogrammetric cameras.

   
Fiducial marks Small crosses or small v-shaped indents located precisely on each of the four corners, exactly midway along the four sides of a standard-aerial photograph, or both.

When you identify the fiducial marks in a scanned image, the fiducial marks from the camera-calibration report are used to establish a frame of image coordinates.

Tip: If your scanned imagery does not have fiducial marks, you can collect them by running the CATALYST Professional AUTOFID algorithm.
Note: Images acquired with digital cameras do not have fiducial marks.
 
Chip size Physical size of the charged-coupled device (CCD) in a digital camera.

Images from digital cameras do not contain fiducial marks; therefore, the size of the CCD is used to calculate the geometry of the camera. With most cameras the sensor cells are square; however, some (especially video cameras) can have sensor cells that are rectangular.

This parameter is required for images acquired with digital cameras.

Y-scale factor Ratio between the horizontal and the vertical size of each sensor cell in digital cameras.

The y-scale factor is used when the CCD pixels are not square. Using the chip size and y-scale factor, the digital image is converted automatically to a normalized, square-image coordinate system. The image can then be processed during the computation of the math model (the bundle adjustment) in the same way as an image acquired with a scanned-film camera.

   
* Scanned-film not applicable in CATALYST Enterprise.

Format of the camera-calibration file

The camera-calibration file, camera_calib.xml, is stored typically in the same folder as the input imagery. It must contain, at a minimum, the focal length of the camera used to acquire the imagery and the chip size of the charge-coupled device (CCD).

Scanned-film camera
            The following example shows a proposed configuration structure for a scanned-film camera.

<CAMERA NAME="my_calib_name">
	<LENS_SERIAL>my_serial</LENS_SERIAL>
	<CALIB_SOURCE>my_calib_source</CALIB_SOURCE>
	<CALIB_DATE>my_date</CALIB_DATE>
	<FL>90</FL>
	<StdDevFL>0.01</StdDevFL>
	<SYMMETRY PPX="0.27" PPY="0.13"/>
	<STDDEV PPX="0.001" PPY="0.001"/>
	<RLDC name="R0">0.67</RLDC>
	<RLDC name="R1">0</RLDC>
	<RLDC name="R2">0</RLDC>
	<RLDC name="R3">0.46</RLDC>
	<RLDC name="R4">0</RLDC>
	<RLDC name="R5">0</RLDC>
	<RLDC name="R6">0</RLDC>
	<RLDC name="R7">0</RLDC>
	<DDC name="P1">0</DDC>
	<DDC name="P2">0</DDC>
	<DDC name="P3">0</DDC>
	<DDC name="P4">0</DDC>
	<FILM>
		<EDGECORNER/>
		<FID_COORD name="TopLeft" FID_X="1.3" FID_Y="1.5"/>
		<FID_COORD name="TopMiddle" FID_X="1.5" FID_Y="1.3"/>
		<FID_COORD name="TopRight" FID_X="1.3" FID_Y="1.5"/>
		<FID_COORD name="RightMiddle" FID_X="1.5" FID_Y="1.3"/>
		<FID_COORD name="BottomRight" FID_X="1" FID_Y="1"/>
		<FID_COORD name="BottomMiddle" FID_X="1" FID_Y="1"/>
		<FID_COORD name="BottomLeft" FID_X="1" FID_Y="1"/>
		<FID_COORD name="LeftMiddle" FID_X="1" FID_Y="1"/>
	</FILM>
</CAMERA>

Digital camera
The following example shows a proposed configuration structure for a digital camera.

<CAMERA NAME="my_calib_name">
	<LENS_SERIAL>my_serial</LENS_SERIAL>
	<CALIB_SOURCE>my_calib_source</CALIB_SOURCE>
	<CALIB_DATE>my_date</CALIB_DATE>
	<FL>100.5</FL> 
	<SYMMETRY PPX="1.400" PPY="0.000" /> 
	<RLDC name="R0">0</RLDC> 
	<RLDC name="R1">0</RLDC> 
	<RLDC name="R2">0</RLDC> 
	<RLDC name="R3">0</RLDC> 
	<RLDC name="R4">0</RLDC> 
	<RLDC name="R5">0</RLDC> 
	<RLDC name="R6">0</RLDC> 
	<RLDC name="R7">0</RLDC> 
	<DDC name="P1">0</DDC> 
	<DDC name="P2">0</DDC> 
	<DDC name="P3">0</DDC> 
	<DDC name="P4">0</DDC> 
	<DIGITAL>
		<CHIP_SIZE WIDTH="103.860" HEIGHT="67.860" /> 
		<YSCALE>1.000</YSCALE> 
	</DIGITAL>
</CAMERA>

Each XML tag in the camera-calibration file represents a specific parameter required for the development of an airphoto math model.

The XML tags are:
  • CAMERA NAME: Name of the camera used to acquire the imagery
  • FL: Focal length of the camera used to acquire the imagery
  • SYMMETRY PPX PPY: Principal-point offset of the camera
  • RLDC R0 - R7: Radial-lens distortion parameters of the camera
  • DDC P1 - P4: Decentering-distortion parameters of the camera
  • CHIP_SIZE WIDTH HEIGHT: Size, in millimeters, of the CCD used by the camera
  • YSCALE: Y-scale factor of the camera used
  • FILM: The following parameters affect the positioning of the fiducial marks.
    • EDGE: Fiducial marks occur along the edge of the imagery.
    • CORNER: Fiducial marks occur at the corners of the imagery.
    • EDGECORNER: Fiducial marks occur along the edge and at the corners of the imagery.
    • FID COORD: X and y coordinates of the fiducial marks, in milimeters.

If your images align along flight lines, but not between them, it is possible that the principal-point offsets are incorrect and need to be adjusted. This occurs most often if you have rotated the kappa value of your EO file. If so, your camera-calibration file will no longer be accurate. For example, if the kappa has been rotated by 90 degrees, use the information in the following table to correct the principal-point offset (PP) of the camera calibration.

Original PP Kappa rotation Modified PP

PP_X = x_mm
PP_Y = y_mm

0 degrees clockwise

PP_X = x_mm
PP_Y = y_mm

PP_X = x_mm
PP_Y = y_mm

90 degrees clockwise

PP_X = y_mm
PP_Y = -x_mm

PP_X = x_mm
PP_Y = y_mm

270 degrees clockwise

PP_X = -y_mm
PP_Y = x_mm

PP_X = x_mm
PP_Y = y_mm

180 degrees clockwise

PP_X = -x_mm
PP_Y = -y_mm

Important points to remember about camera calibration
  • When you process a small amount of data, and you notice that your images look compressed in one direction, check to see if the chip-size width and height are reversed in your camera-calibration file.
  • Camera-calibration files will be the same for the same camera on the same plane and can be reused repeatedly. It is recommended that you retain them in a central, easily accessible location for future reference.

To process aerial imagery, you must have an XML file of camera-calibration information as described herein. The camera-calibration information is based on the camera-calibration report that comes with the imagery or that you obtain from the camera manufacturer. If you do not have an XML file of this information, you can create one yourself, as shown in the preceding example.

Each tag in the XML file represents a particular parameter required for the development of an airphoto math model. A document type definition (DTD) file is also required to validate the XML file so that it can be read. To help you with creating and validating your camera-calibration file (.xml), a sample file (camera_calib_sample.xml) and a sample DTD file (camera_calib.dtd) are available in the etc folder of your installation.

Note: All images in the specified OrthoEngine project file are processed, regardless of whether they are active or inactive.
Back to top

Example

An OrthoEngine project file, airphoto_model.prj, contains project information that does not include camera-calibration information. The camera-calibration information is provided in a calib.xml file. The following is an example of the content of the XML file:

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE CAMERA SYSTEM "camera_calib.dtd">
<CAMERA NAME="ULTRACAM">
<FL>101.4</FL>
<SYMMETRY PPX="0.0" PPY="0.0"/>
<RLDC name="R0">0</RLDC>
<RLDC name="R1">0</RLDC>
<RLDC name="R2">0</RLDC>
<RLDC name="R3">0 </RLDC>
<RLDC name="R4">0</RLDC>
<RLDC name="R5">0</RLDC>
<RLDC name="R6">0</RLDC>
<RLDC name="R7">0</RLDC>
<DDC name="P1">0</DDC>
<DDC name="P2">0</DDC>
<DDC name="P3">0</DDC>
<DDC name="P4">0</DDC>
<DIGITAL>
<CHIP_SIZE WIDTH="103.500" HEIGHT="67.5000"/>
<YSCALE>1.000</YSCALE>
</DIGITAL>
</CAMERA>
        

Each XML tag in the camera-calibration file represents a particular parameter required for the development of an airphoto math model. For more information about the parameters, see Details.

The project information is updated with the camera-calibration information from calib.xml, and then written to a new OrthoEngine project file, airphoto_calib_model.prj.

from pci.camimport import camimport

oeproji  =  "airphoto_model.prj"  # input project file
tfile  =  "calib.xml"  # camera-calibration XML file
oeprojo  =  "airphoto_calib_model.prj"  # output project file

camimport(oeproji, tfile, oeprojo)

oeproji  =  "airphoto_model.prj"  # input project file
tfile  =  "test_pix4d_calibrated_internal_camera_parameters.cam"  # camera-calibration Pix4D file
oeprojo  =  "airphoto_calib_model.prj"  # output project file

camimport(oeproji, tfile, oeprojo)

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