How to perform image registration on a collection of images


Summary
Image registration operates on a mosaic dataset, so a mosaic dataset must be created from the collection of images. Image registration can work with any type of ortho or sensor image as long as the image is supported by raster types, and as long as the images in the mosaic dataset have overlaps.

Performing image registration

The basic steps of image registration using the ImageRegistration class are as follows:
  1. Create the feature point table from the input mosaic dataset.
  2. Create tie points from the feature point table.
  3. Compute links from the tie points.
  4. Compute adjustments.
  5. Apply the solution to the mosaic dataset if the estimated error is acceptable.
The following code snippet demonstrates the basic workflow:
[C#]
// Open a mosaic dataset in a file geodatabase.
Type factoryType = null;
factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory");
IWorkspaceFactory wsf = Activator.CreateInstance(factoryType)as IWorkspaceFactory;

IWorkspace ws = wf.OpenFromFile("c:\fgdb.gdb", 0);
IMosaicWorkspaceExtensionHelper wsHelper = new MosaicWorkspaceExtensionHelperClass();
IMosaicWorkspaceExtension wsEx = wsHelper.FindExtension(ws);
IDataset md = (IDataset)wsEx.OpenMosaicDataset("mosaicdatasetname");

// Get the spatial reference for control points and feature points (or create your own spatial reference).
IGeoDataset md_geo = (IGeoDataset)md;
ISpatialReference sr = md_geo.SpatialReference;

// Create the ImageRegistration object.
IImageRegistration imageRegistration = new ImageRegistrationClass();

// Prepare the feature point table for feature point extraction.
ITable featurePoint = imageRegistration.CreateFeaturePointTable(ws, "featurepoint",
    sr, "default");

// Prepare the control point table for calculating control points.
ITable tiePoint = imageRegistration.CreateControlPointTable(ws, "controlpoint", sr, 
    "default");

// Prepare the solution table for caculating adjustment.
ITable solutionTable = imageRegistration.CreateSolutionTable(ws, "solutiontable", sr,
    "default");

// Generate feature points from images in the mosaic dataset.
imageRegistration.ComputeFeaturePoints(md, null, null, null, featurePoint, null);

// Compute tie points from the feature point table.
imageRegistration.ComputeTiePoints(featurePoint, null, tiePoint, null);

// Compute links from the tie point.
imageRegistration.ComputeLinks(tiePoint, null, solutionTable, null);

// Compute adjustment from the mosaic dataset using the computed links.
imageRegistration.ComputeAdjustments(md, null, solutionTable, 2, null);

// If the RMS is acceptable, apply the adjustment to the mosaic dataset.
imageRegistration.Adjust(md, null, esriImageAdjustmentType.esriImageAdjustmentAppend,
    solutionTable, null);
[VB.NET]
' Open a mosaic dataset in a file geodatabase.
Dim factoryType As Type = Nothing
factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory")
Dim wsf As IWorkspaceFactory = TryCast(Activator.CreateInstance(factoryType), IWorkspaceFactory)

Dim ws As IWorkspace = wf.OpenFromFile("c:" & vbFormFeed & "gdb.gdb", 0)
Dim wsHelper As IMosaicWorkspaceExtensionHelper = New MosaicWorkspaceExtensionHelperClass()
Dim wsEx As IMosaicWorkspaceExtension = wsHelper.FindExtension(ws)
Dim md As IDataset = DirectCast(wsEx.OpenMosaicDataset("mosaicdatasetname"), IDataset)

' Get the spatial reference for control points and feature points (or create your own spatial reference).
Dim md_geo As IGeoDataset = DirectCast(md, IGeoDataset)
Dim sr As ISpatialReference = md_geo.SpatialReference

' Create the ImageRegistration object.
Dim imageRegistration As IImageRegistration = New ImageRegistrationClass()

' Prepare the feature point table for feature point extraction.
Dim featurePoint As ITable = imageRegistration.CreateFeaturePointTable(ws, "featurepoint", sr, "default")

' Prepare the control point table for calculating control points.
Dim tiePoint As ITable = imageRegistration.CreateControlPointTable(ws, "controlpoint", sr, "default")

' Prepare the solution table for calculating adjustment.
Dim solutionTable As ITable = imageRegistration.CreateSolutionTable(ws, "solutiontable", sr, "default")

' Generate feature points from images in the mosaic dataset.
imageRegistration.ComputeFeaturePoints(md, Nothing, Nothing, Nothing, featurePoint, Nothing)

' Compute tie points from the feature point table.
imageRegistration.ComputeTiePoints(featurePoint, Nothing, tiePoint, Nothing)

' Compute links from the tie point.
imageRegistration.ComputeLinks(tiePoint, Nothing, solutionTable, Nothing)

' Compute adjustment from the mosaic dataset using the computed links.
imageRegistration.ComputeAdjustments(md, Nothing, solutionTable, 2, Nothing)

' If the RMS is acceptable, apply the adjustment to the mosaic dataset.
imageRegistration.Adjust(md, Nothing, esriImageAdjustmentType.esriImageAdjustmentAppend, solutionTable, Nothing)






To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
Development licensing Deployment licensing
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced