Announcement: All noncommercial projects registered to use Earth Engine before April 15, 2025 must verify noncommercial eligibility to maintain Earth Engine access.
Stay organized with collections
Save and categorize content based on your preferences.
The Earth Engine image registration algorithm is designed to be a final,
post-ortho, fine-grained step in aligning images. It is assumed that the images
to be registered have already gone through initial alignment stages, so they are
already within a few degrees of rotation of one another, and differ by only
small translations. The registration uses a "rubber-sheet" technique, allowing
local image warping to correct for orthorectification errors and other artifacts
from earlier processing. The underlying alignment technique is image
correlation, so the bands for the input and reference images must be visually
similar in order for the algorithm to compute an accurate alignment.
Image displacement
There are two steps to registering an image: Determining the displacement image
using displacement(), and then applying it with displace(). The required
inputs are the pair of images to register, and a maximum displacement parameter
(maxOffset).
The displacement() algorithm takes a reference image, a maximum displacement
parameter (maxOffset), and two optional parameters that modify the algorithm
behaviour. The output is a displacement image with bands dx and dy which
give the X and Y components (in meters) of the displacement vector at each
pixel.
All bands of the calling and reference images are used for matching during
registration, so the number of bands must be exactly equal. The input bands must
be visually similar for registration to succeed. If that is not the case, it may
be possible to pre-process them (e.g. smoothing, edge detection) to make them
appear more similar. The registration computations are performed using a
multiscale, coarse-to-fine process, with (multiscale) working projections that
depend on three of the projections supplied to the algorithm:
the default projection of the calling image (Pc)
the default projection of the reference image (Pr)
the output projection (Po)
The highest resolution working projection (Pw will be in the CRS of
Pr, at a scale determined by the coarsest resolution of these 3
projections, to minimize computation. The results from Pr are then
resampled to be in the projection specified by the input 'projection' parameter.
The output is a displacement image with the following bands:
dx
For a given reference image pixel location, this band contains the
distance in the X direction that must be travelled to arrive at the matching
location in the calling image. Units are in geodesic meters.
dy
For a given reference image pixel location, this band contains the
distance in the Y direction that must be travelled to arrive at the matching
location in the calling image. Units are in geodesic meters.
confidence
This is a per-pixel estimate of displacement confidence (where 0
is low confidence and 1 is high confidence) based on the correlation scores
in regions where valid matches were found. In regions where no matches were
found, confidence is estimated from nearby correlations using a Gaussian
kernel to provide higher weight to nearby correlations.
The following example computes the magnitude and angle of displacement between
two high-resolution Terra Bella images:
There are two ways to warp an image to match another image: displace() or
register(). The displace() algorithm takes a displacement image having dx
and dy bands as the first two bands, and warps the image accordingly. The
output image will be the result of warping the bands of the input image by the
offsets present in the displacement image. Using the displacements computed in
the previous example:
If you don't need the displacement bands, Earth Engine provides the register()
method, which is a shortcut for calling displacement() followed by
displace(). For example:
In this example, the results of register() differ from the results of
displace(). This is because a different set of bands was used in the two
approaches: register() always uses all bands of the input images, while the
displacement() example used only the red band before feeding the result to
displace(). Note that when multiple bands are used, if band variances are very
different this could over-weight the high-variance bands, since the bands are
jointly normalized when their spatial correlation scores are combined. This
illustrates the importance of selecting band(s) that are visually the most
similar when registering. As in the previous example, use displacement() and
displace() for control over which bands are used to compute displacement.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[[["\u003cp\u003eThe Earth Engine image registration algorithm is a fine-grained alignment tool for images that are already roughly aligned, using a "rubber-sheet" technique to correct for small errors.\u003c/p\u003e\n"],["\u003cp\u003eImage registration involves two steps: determining the displacement image using \u003ccode\u003edisplacement()\u003c/code\u003e and applying it with \u003ccode\u003edisplace()\u003c/code\u003e, both requiring a reference image and a maximum displacement parameter.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003edisplacement()\u003c/code\u003e algorithm outputs a displacement image with bands indicating the X and Y displacement (in meters) and a confidence level for each pixel.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003edisplace()\u003c/code\u003e algorithm warps an image based on a provided displacement image, aligning it with the reference image used to generate the displacement.\u003c/p\u003e\n"],["\u003cp\u003eEarth Engine's \u003ccode\u003eregister()\u003c/code\u003e method combines \u003ccode\u003edisplacement()\u003c/code\u003e and \u003ccode\u003edisplace()\u003c/code\u003e for a streamlined registration process, but may use different bands for alignment than explicitly using \u003ccode\u003edisplacement()\u003c/code\u003e and \u003ccode\u003edisplace()\u003c/code\u003e.\u003c/p\u003e\n"]]],["The Earth Engine algorithm aligns images through a \"rubber-sheet\" technique, correcting for minor misalignments post-initial alignment. Key actions involve determining and applying image displacement. `displacement()` computes the `dx` and `dy` offset bands, and a confidence band, using image correlation; it requires the input and reference images, and the maximum offset. `displace()` warps an image using a precomputed displacement image. `register()` combines both processes. Input bands need visual similarity for accurate matching.\n"],null,["# Registering Images\n\nThe Earth Engine image registration algorithm is designed to be a final,\npost-ortho, fine-grained step in aligning images. It is assumed that the images\nto be registered have already gone through initial alignment stages, so they are\nalready within a few degrees of rotation of one another, and differ by only\nsmall translations. The registration uses a \"rubber-sheet\" technique, allowing\nlocal image warping to correct for orthorectification errors and other artifacts\nfrom earlier processing. The underlying alignment technique is image\ncorrelation, so the bands for the input and reference images must be visually\nsimilar in order for the algorithm to compute an accurate alignment.\n\nImage displacement\n------------------\n\nThere are two steps to registering an image: Determining the displacement image\nusing `displacement()`, and then applying it with `displace()`. The required\ninputs are the pair of images to register, and a maximum displacement parameter\n(`maxOffset`).\n\nThe `displacement()` algorithm takes a reference image, a maximum displacement\nparameter (`maxOffset`), and two optional parameters that modify the algorithm\nbehaviour. The output is a displacement image with bands `dx` and `dy` which\ngive the X and Y components (in meters) of the displacement vector at each\npixel.\n\nAll bands of the calling and reference images are used for matching during\nregistration, so the number of bands must be exactly equal. The input bands must\nbe visually similar for registration to succeed. If that is not the case, it may\nbe possible to pre-process them (e.g. smoothing, edge detection) to make them\nappear more similar. The registration computations are performed using a\nmultiscale, coarse-to-fine process, with (multiscale) working projections that\ndepend on three of the projections supplied to the algorithm:\n\n1. the default projection of the calling image (*P~c~*)\n2. the default projection of the reference image (*P~r~*)\n3. the output projection (*P~o~*)\n\nThe highest resolution working projection (*P~w~* will be in the CRS of\n*P~r~* , at a scale determined by the coarsest resolution of these 3\nprojections, to minimize computation. The results from *P~r~* are then\nresampled to be in the projection specified by the input 'projection' parameter.\n\nThe output is a displacement image with the following bands:\n\n`dx`\n: For a given reference image pixel location, this band contains the\n distance in the X direction that must be travelled to arrive at the matching\n location in the calling image. Units are in geodesic meters.\n\n`dy`\n: For a given reference image pixel location, this band contains the\n distance in the Y direction that must be travelled to arrive at the matching\n location in the calling image. Units are in geodesic meters.\n\n`confidence`\n: This is a per-pixel estimate of displacement confidence (where 0\n is low confidence and 1 is high confidence) based on the correlation scores\n in regions where valid matches were found. In regions where no matches were\n found, confidence is estimated from nearby correlations using a Gaussian\n kernel to provide higher weight to nearby correlations.\n\nThe following example computes the magnitude and angle of displacement between\ntwo high-resolution [Terra Bella](https://terrabella.google.com/) images:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Load the two images to be registered.\nvar image1 = ee.Image('SKYSAT/GEN-A/PUBLIC/ORTHO/MULTISPECTRAL/s01_20150502T082736Z');\nvar image2 = ee.Image('SKYSAT/GEN-A/PUBLIC/ORTHO/MULTISPECTRAL/s01_20150305T081019Z');\n\n// Use bicubic resampling during registration.\nvar image1Orig = image1.resample('bicubic');\nvar image2Orig = image2.resample('bicubic');\n\n// Choose to register using only the 'R' band.\nvar image1RedBand = image1Orig.select('R');\nvar image2RedBand = image2Orig.select('R');\n\n// Determine the displacement by matching only the 'R' bands.\nvar displacement = image2RedBand.displacement({\n referenceImage: image1RedBand,\n maxOffset: 50.0,\n patchWidth: 100.0\n});\n\n// Compute image offset and direction.\nvar offset = displacement.select('dx').hypot(displacement.select('dy'));\nvar angle = displacement.select('dx').atan2(displacement.select('dy'));\n\n// Display offset distance and angle.\nMap.addLayer(offset, {min:0, max: 20}, 'offset');\nMap.addLayer(angle, {min: -Math.PI, max: Math.PI}, 'angle');\nMap.setCenter(37.44,0.58, 15);\n```\n\nWarping an image\n----------------\n\nThere are two ways to warp an image to match another image: `displace()` or\n`register()`. The `displace()` algorithm takes a displacement image having `dx`\nand `dy` bands as the first two bands, and warps the image accordingly. The\noutput image will be the result of warping the bands of the input image by the\noffsets present in the displacement image. Using the displacements computed in\nthe previous example:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Use the computed displacement to register all original bands.\nvar registered = image2Orig.displace(displacement);\n\n// Show the results of co-registering the images.\nvar visParams = {bands: ['R', 'G', 'B'], max: 4000};\nMap.addLayer(image1Orig, visParams, 'Reference');\nMap.addLayer(image2Orig, visParams, 'Before Registration');\nMap.addLayer(registered, visParams, 'After Registration');\n```\n\nIf you don't need the displacement bands, Earth Engine provides the `register()`\nmethod, which is a shortcut for calling `displacement()` followed by\n`displace()`. For example:\n\n### Code Editor (JavaScript)\n\n```javascript\nvar alsoRegistered = image2Orig.register({\n referenceImage: image1Orig,\n maxOffset: 50.0,\n patchWidth: 100.0\n});\nMap.addLayer(alsoRegistered, visParams, 'Also Registered');\n```\n\nIn this example, the results of `register()` differ from the results of\n`displace()`. This is because a different set of bands was used in the two\napproaches: `register()` always uses all bands of the input images, while the\n`displacement()` example used only the red band before feeding the result to\n`displace()`. Note that when multiple bands are used, if band variances are very\ndifferent this could over-weight the high-variance bands, since the bands are\njointly normalized when their spatial correlation scores are combined. This\nillustrates the importance of selecting band(s) that are visually the most\nsimilar when registering. As in the previous example, use `displacement()` and\n`displace()` for control over which bands are used to compute displacement."]]