公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
注册图片
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Earth Engine 图片注册算法旨在作为对齐图片的最终、后正射精细步骤。假设要注册的图片已完成初始对齐阶段,因此它们的旋转角度相差不超过几度,并且仅存在细微的平移差异。注册使用“橡皮版”技术,允许局部图像扭曲以校正正射校正误差和之前处理过程中产生的其他伪影。底层对齐技术是图像相关性,因此输入图片和参考图片的波段必须在视觉上相似,才能让算法计算出准确的对齐结果。
图片偏移
注册图片需要完成以下两个步骤:使用 displacement()
确定位移图片,然后使用 displace()
应用该图片。必需的输入是要注册的一对图片,以及一个最大位移参数 (maxOffset
)。
displacement()
算法接受一个参考图片、一个最大位移参数 (maxOffset
) 以及两个用于修改算法行为的可选参数。输出是带有 dx
和 dy
波段的位移图像,其中给出了每个像素处位移矢量的 X 和 Y 分量(以米为单位)。
调用图片和参考图片的所有波段都将在注册期间用于匹配,因此波段数必须完全相同。输入频段必须在视觉上相似,才能成功注册。如果不是这样,您可以对它们进行预处理(例如平滑、边缘检测),使它们看起来更相似。注册计算是使用多尺度粗到精的流程执行的,其中(多尺度)工作投影取决于向算法提供的三个投影:
- 调用图片的默认投影 (Pc)
- 参照图像的默认投影 (Pr)
- 输出投影 (Po)
最高分辨率的工作投影 (Pw) 将采用 Pr 的 CRS,其比例由这 3 个投影中最粗糙的分辨率决定,以最大限度地减少计算量。然后,系统会对 Pr 的结果进行重新采样,使其采用输入“projection”参数指定的投影。
输出是一个包含以下波段的位移图像:
dx
- 对于给定的参考图片像素位置,此带包含必须沿 X 方向行进的距离,才能到达调用图片中的匹配位置。单位为测地线米。
dy
- 对于给定的参考图片像素位置,此带包含必须沿 Y 方向行进的距离,才能到达调用图片中的匹配位置。单位为测地线米。
confidence
- 这是基于找到有效匹配区域中的相关性得分估算的每个像素的位移置信度(其中 0 表示低置信度,1 表示高置信度)。在未找到匹配项的区域,系统会使用高斯核从附近的相关性中估算置信度,以便为附近的相关性提供更高的权重。
以下示例计算了两个高分辨率 Terra Bella 图片之间的位移幅度和角度:
Code Editor (JavaScript)
// Load the two images to be registered.
var image1 = ee.Image('SKYSAT/GEN-A/PUBLIC/ORTHO/MULTISPECTRAL/s01_20150502T082736Z');
var image2 = ee.Image('SKYSAT/GEN-A/PUBLIC/ORTHO/MULTISPECTRAL/s01_20150305T081019Z');
// Use bicubic resampling during registration.
var image1Orig = image1.resample('bicubic');
var image2Orig = image2.resample('bicubic');
// Choose to register using only the 'R' band.
var image1RedBand = image1Orig.select('R');
var image2RedBand = image2Orig.select('R');
// Determine the displacement by matching only the 'R' bands.
var displacement = image2RedBand.displacement({
referenceImage: image1RedBand,
maxOffset: 50.0,
patchWidth: 100.0
});
// Compute image offset and direction.
var offset = displacement.select('dx').hypot(displacement.select('dy'));
var angle = displacement.select('dx').atan2(displacement.select('dy'));
// Display offset distance and angle.
Map.addLayer(offset, {min:0, max: 20}, 'offset');
Map.addLayer(angle, {min: -Math.PI, max: Math.PI}, 'angle');
Map.setCenter(37.44,0.58, 15);
扭曲图片
您可以通过以下两种方式将图片扭曲以匹配另一张图片:displace()
或 register()
。displace()
算法会将以 dx
和 dy
波段作为前两个波段的位移图像作为输入,并相应地扭曲该图像。输出图片是通过将输入图片的波段按位移图片中的偏移量进行扭曲而得出的。使用上例中计算的位移:
Code Editor (JavaScript)
// Use the computed displacement to register all original bands.
var registered = image2Orig.displace(displacement);
// Show the results of co-registering the images.
var visParams = {bands: ['R', 'G', 'B'], max: 4000};
Map.addLayer(image1Orig, visParams, 'Reference');
Map.addLayer(image2Orig, visParams, 'Before Registration');
Map.addLayer(registered, visParams, 'After Registration');
如果您不需要位移带,Earth Engine 提供了 register()
方法,该方法是调用 displacement()
后跟 displace()
的快捷方式。例如:
Code Editor (JavaScript)
var alsoRegistered = image2Orig.register({
referenceImage: image1Orig,
maxOffset: 50.0,
patchWidth: 100.0
});
Map.addLayer(alsoRegistered, visParams, 'Also Registered');
在此示例中,register()
的结果与 displace()
的结果不同。这是因为这两种方法使用了不同的波段组:register()
始终使用输入图片的所有波段,而 displacement()
示例仅在将结果馈送给 displace()
之前使用红色波段。请注意,使用多个波段时,如果波段方差非常不同,这可能会过度加权高方差波段,因为在合并空间相关性得分时,波段会共同归一化。这说明在注册时选择视觉上最相似的频段非常重要。与上一个示例一样,使用 displacement()
和 displace()
来控制用于计算位移的波段。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\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."]]