IT

Photogrammetry and drones · 3 February 2018

Photogrammetry with PhotoScan part 3 – camera calibration

The third article in Paolo Rossi's series on photogrammetry with Agisoft PhotoScan: why and how cameras are calibrated before images are aligned.

This article is about photogrammetry with PhotoScan and camera calibration before the images are aligned.

The third part of this series by Paolo Rossi on modern photogrammetry and the Agisoft PhotoScan software deals with the last preliminary step before image alignment: calibration.

You’ll find the first article at this link.
And the second at this one.

Camera calibration

Before aligning the images, you need to set up the calibration.
It’s a cross-cutting process that starts with setting some parameters and ends, after the alignment has been optimised, with analysing the results.

After a short introduction to camera calibration, we’ll go into PhotoScan in detail to see how to work with the software.

Why calibrate

Calibration is a very important phase when photographs are used for 3D reconstructions with metric aims: it calculates the camera’s interior calibration parameters and the distortions the lenses cause in the image.

Classic photogrammetry (aerial photogrammetric flights with aircraft) uses metric cameras and GNSS and IMU sensors.
Metric cameras come with calibration certificates stating their distortions and interior parameters.
They’re very expensive, so vibrations and knocks must be avoided!
With the development of terrestrial and UAV applications and of photogrammetry based on Structure from Motion algorithms, the trend is towards cheaper equipment: DSLRs, compacts, mirrorless cameras, action cameras.
But the need to determine the camera’s interior parameters and the image distortions remains, and it can be met through the calibration procedure.

Types of calibration

There are different approaches to camera calibration:

Pre-calibration: done with objects of known size or 2D/3D checkerboards.
This lets you calculate parameters and distortions.
Calibration is usually done in the office, before the fieldwork, and therefore in different environmental conditions.

On-site calibration: done at the same time as the job.
A test area is set up right next to the survey area, where the camera’s characteristics are estimated using objects of known size or control points.

Self-calibration: here the dataset acquired for the job is also used to calibrate the camera.

For UAV applications or, more generally, those using compact and consumer cameras, I’d recommend this last approach because it’s faster, automatic and effective.
Self-calibration reduces time in the field: there’s no need to set up and survey a test site.
However, ground measurements, the so-called control points, are needed to give the product metric content and correct the distortions.
Self-calibration also ensures the calculated results match the real operating conditions: changes in temperature and pressure, vibration and transporting the equipment can alter the camera’s internal configuration (compared with the laboratory or test site), especially for consumer cameras.

The different types of camera calibration in photogrammetry

Camera calibration in PhotoScan

PhotoScan supports various types of camera, which it calibrates with suitable equations and adjustments.
You reach the camera calibration window from the Tools menu, Camera Calibration.

Frame cameras: the most common, from DSLRs to compacts.
This type is set automatically in the software.
In the other cases you have to remember to change it manually!

Fisheye: short focal length cameras with wide-angle lenses (the GoPro and other action cameras are an example).
You have to set this type so that PhotoScan uses a calibration model suited to these cameras.

Spherical/cylindrical: I haven’t yet worked with these types, but they identify the projection used (equirectangular or cylindrical) in producing panoramic images.

I’ll refer to frame and fisheye cameras, the types I know best and the ones you’re most likely to work with if you use UAVs or consumer cameras on the ground.

EXIF data

The camera information is extracted automatically by the software when the images are loaded.
The image’s EXIF data contain information on the camera model, sensor size [mm] and focal length [mm].
These data are used to calculate the focal length in pixels, a variable used in the calibration models.
If the EXIF data are missing, or the information in them isn’t enough, it’s advisable to enter the focal length and sensor size into the software manually.
You’ll find them in the camera’s datasheet (technical specifications).

The calibration window

This is the Camera Calibration window:

The camera calibration window in Agisoft PhotoScan

  • Area 1 shows the camera type and the information read from the EXIF data.
  • Area 2 lists the camera groups.
    If several cameras were used in a job, or the same one with different settings, it’s best to separate them into groups so that the calibration models act differently.
    This grouping concerns only the calibration phase and the calculation of distortions and interior parameters, and is different from what we saw when importing images and organising them in folders in the workspace.
  • Area 3 lists the images in each group.
  • Area 4 is organised as a table: its values differ according to the calibration group selected.
    They’re arranged in three tabs: Initial, Adjusted, GPS/INS Offset.

The Initial tab contains the initial calibration values.
They can be read automatically from the EXIF data (we’ll find the focal length) or come from a pre-calibration process and be entered by the user.
You can fix the calibration parameters in this tab so they don’t change during image alignment and later optimisations.
This is needed when you believe you’ve carried out a correct pre-calibration suitable for the job at hand.
If Fix calibration isn’t ticked, the software recalculates and updates the interior parameters following a self-calibration approach.
The Adjusted tab contains the parameters calculated after alignment, which will be updated at every subsequent optimisation of the alignment (self-calibration approach).
If you have information on the position and attitude of the camera, you can enter it in the GPS/INS Offset tab. Here too there are initial values (with their own accuracy) that can be recalculated during alignment or kept fixed.

Calibration parameters and models in PhotoScan

Here’s the list of camera calibration parameters used by the software:

  • f: focal length [pix]
  • cx, cy: principal point coordinates [pix]
  • skew: skew coefficient between the x and y axes [dimensionless]
  • k1, k2, k3, k4: radial distortion coefficients [dimensionless]
  • p1, p2, p3, p4: tangential distortion coefficients [dimensionless]

The calibration model implemented in PhotoScan is similar to Brown’s: parametric, central projection with non-linear distortions.
The equations differ depending on whether the camera is frame or fisheye (you’ll find more information in Appendix C of the manual).

Calibration outputs

You can export the calibration parameters to save them, compare them or use them in other jobs (Camera Calibration, import/export).

You can also view plots and tables of the calculated parameters (Camera Calibration, right-click on the camera group, Distortion Plot).
They show the plot of the distortions calculated on the images; the residuals, vectors representing the pixel reprojection errors; and the correlation table, which summarises the calculated values with their errors and the correlation between parameters.

The outputs of camera calibration in PhotoScan

These outputs are used to judge the quality of the calibration and decide whether we’re satisfied with it.
Searching online, I found a couple of comments worth passing on:

low residuals = good calibration

correlated parameters cause instability in the calibration

These analyses are clearly tied to the specific job and the desired product.

As a non-photogrammetrist, I usually look at the residuals on the control points (we’ll talk about them after alignment!), but I think all aspects deserve consideration.

I hope this article by Paolo Rossi on camera calibration for photogrammetry with PhotoScan is useful to you too.
For doubts or questions, get in touch!

See you soon!

Paolo Corradeghini

These are the articles in this series:

Photo of Paolo RossiPaolo Rossi, engineer and PhD in Industrial and Environmental Engineering at the University of Modena and Reggio Emilia, works at the Geomatics Laboratory of the “Enzo Ferrari” Department of Engineering, on 3D reconstruction from images.

← All articles