Photogrammetry with PhotoScan part 4 – image alignment
The fourth article in Paolo Rossi's series on Agisoft PhotoScan: how image alignment works, feature detection, collinearity equations and the Align Photos settings.
Clicking loads the video from YouTube: Google will receive your IP address and may store data on your device. Privacy · Watch it on YouTube
This article is about photogrammetry with PhotoScan and the image alignment process.
This is episode four of the series by Paolo Rossi on photogrammetry with the Agisoft PhotoScan software, and it deals with image alignment.
You’ll find the first article at this link.
The second at this one.
And the third here.
Image alignment
In the previous episodes we saw the preliminary operations to carry out on the imported images and their calibration settings.
In this post I’ll explain how image alignment works: the first operation that gives you a 3D product from the survey!
Alignment serves to position the images correctly relative to one another or, if they’re already geotagged, to calculate their exact position in real space.
But back to the images.
They can have no location or carry, in their EXIF data (metadata), information on where they were taken.
This is common with smartphones and drones.
In PhotoScan you can recognise a geotagged image because it appears on screen with a blue dot and, in the Reference panel under Cameras, each image ID is accompanied by numbers giving its position: the coordinates of the camera centre.
How does alignment work?
And above all, how do SfM (Structure from Motion) algorithms work?
Before we start, let’s clarify some terminology:
- image space: the matrix that makes up the captured image; rows and columns are called ξ and η and bound the pixels;
- real space: the 3D world (x, y, z) in which the survey and reconstruction take place. The coordinates depend on the chosen reference system (you can also choose to work in an arbitrary but scaled system, or in a completely arbitrary system unrelated to reality).
A feature detection algorithm (Scale Invariant Feature Transform or similar) works on each image, identifying notable, characteristic points.
To qualify, a notable point, or descriptor, must be stable and remain identifiable and distinguishable as the scale, viewing direction and lighting conditions change.
Feature detection algorithms are the truly innovative key point of SfM: they automatically identify thousands of descriptors in each image, freeing you from strict shooting geometries.
The descriptors form the tie points.
For each image there’s a database containing all the descriptors found.
Each descriptor is unique, because it’s characterised by the radiometric behaviour of the image (and therefore of the real scene) around it.
The descriptors of the various images are compared with one another. Matching ones form a link between images and allow them to be positioned relative to each other.
This is the matching phase: searching for and defining tie points between the images that make up the dataset.

In the images above, the dots show the descriptors found in the photo (blue and white depending on whether they’re within or beyond the set limit), and the lines are the matches between the images: the connection between the same tie point on the two images (blue if correct, red if wrong).
Collinearity equations
Once the tie points have been found, the collinearity equations can be set up and solved.
Collinearity along the optical axis is set up between:
- the camera centre,
- the tie points in the image,
- the 3D position of the tie point.
The collinearity equations bridge image space (2D) and real space (3D), relating:
- the position of the tie point in image space;
- the camera calibration parameters;
- the camera’s exterior parameters (position and orientation);
- the coordinates of the tie point in real space.

The basic principles of traditional photogrammetry remind us that a generic point P must appear in at least 2 images to be reconstructed in 3D (so image coordinates known in two frames, 4 equations and 3 unknown coordinates).
In SfM this system explodes into thousands of equations:
- the same tie point P is seen in many images (because of the high data redundancy in the survey),
- thousands of tie points are identified in each image,
- all the camera’s interior and exterior parameters are unknown.
The system of equations is solved in a step called bundle adjustment, where the solutions obtained are optimised.
The outputs are:
- camera positions and orientations,
- camera calibration and distortion parameters,
- the sparse cloud, i.e. the 3D coordinates of the tie points.
The outputs are given in the reference system of the imported images, if they were geotagged; otherwise in an arbitrary local reference system chosen by the software.
N.B.: so far we haven’t yet talked about control points and ground observations.
Align Photos
All the phases described above are summed up in PhotoScan’s Align Photos command, which has various items with parameters to set according to the dataset available and the results you want.
Accuracy: the accuracy of the camera position estimates and the reconstruction.
From Low to Highest the processing time increases, because the resolution of the analysed images increases.
This item refers to the size of the images in which descriptors are searched for:
- High: images at original scale;
- Highest: images upscaled by a factor of 4 (2 per side);
- Medium: images downscaled by a factor of 4;
- Low: images downscaled by a factor of 16 (4 per side).
Pair selection: this concerns image matching and tells the software which image pairs to search for matches between:
- Generic: low-resolution images are compared first to understand which overlap, then it moves to the original resolution;
- Reference: the position of the images is used, if known from the EXIF data.
Key point limit, Tie point limit: these values set the limits on the number of notable points to identify in the images, and on the tie points to use in the alignment.
The value 0 means that all identifiable and identified points are used.
If I set a tie point limit of 4,000, even if the software finds 10,000 possible tie points with other images in each image, only the best 4,000, those most likely to give a correct match, are actually used.
In my view the preset values are fine.
If you know you have a particular dataset (a uniform scene with little texture, low redundancy and image quality, …), you need to run some tests changing the parameter values.
Constrain features by mask: select any masks created to exclude areas from the alignment.
Adaptive camera model fitting: an option that automatically selects which interior camera parameters to include in the adjustment based on their reliability.
If the dataset has strong geometry, this option optimises more parameters; if the geometry is weak, it helps prevent some parameters from diverging (for example radial distortion if the surveyed object is small and in the centre of the images, or the principal point position if the shots were taken along parallel lines).
At the end of the alignment step you’ll see the sparse cloud and the camera positions (blue rectangles) in the Model view, and the adjusted values of the calibration parameters in the Camera Calibration tool.
Already after this first phase you can export some results (Export command in the File menu):
- the sparse cloud (point coordinates, colour, normals),
- the cameras: camera positions and orientations and the values of the interior calibration parameters,
- the tie points: the matches between images.
One of PhotoScan’s strengths is offering many formats for exporting results, allowing it to talk to other software.
Realigning images
Not all images may be aligned, or aligned well, and in these cases you need to realign them manually.
Incorrectly aligned images can be spotted by looking at the 3D model.
If you see parts of the scene detached from the rest, in strange positions, or you notice images in positions that have nothing to do with the survey you did, note the image name and reset its alignment (right-click on the image, Reset Camera Alignment).
Just as simply, you can find in the Photos panel the shots that weren’t aligned by the automatic procedure.
To realign a group of images you need to:
- place at least 4 markers in each of them,
- project these markers in at least 2 images of the aligned dataset,
- select the images to align and run the alignment, where the software will use the markers as certain tie points.
Computing load
The alignment phase is computationally demanding: there are many operations to perform and they take a fair amount of machine time.
Estimating the time needed is impossible, because variables come into play linked to the computer’s characteristics, the number of images and the set-up.
The alignment step uses memory and CPU resources.
In this table, the Agisoft team relates the number of images to the amount of RAM needed (image resolution doesn’t affect this phase).
| Photos | 100 | 200 | 500 | 1000 | 2000 | 5000 | 10000 |
|---|---|---|---|---|---|---|---|
| Memory consumption | 500 MB | 1 GB | 2.5 GB | 5 GB | 10 GB | 25 GB | 50 GB |
Online I found other tests by Puget Systems, a company that builds custom PCs, analysing performance on a sample dataset as the number of CPU cores varies.
The next article will cover adding control points, optimising the alignment and editing tools for the sparse cloud!
I hope this article by Paolo Rossi on image alignment for photogrammetry with PhotoScan is useful to you too.
For doubts or questions, get in touch!
See you soon!
Paolo Corradeghini
Paolo 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.
I published a video on the YouTube channel about image alignment in Metashape (formerly PhotoScan). The video is in Italian.