matchHistogram#

abstract geetools.ee_image.ImageAccessor.matchHistogram(target, bands, geometry=None, maxBuckets=256)#

Adjust the image’s histogram to match a target image.

Parameters:
  • target (ee.Image) – Image to match.

  • bands (dict[str, str]) – A dictionary of band names to match, with source bands as keys and target bands as values.

  • geometry (ee.Geometry | None) – The region to match histograms in that overlaps both images. If none is provided, the geometry of the source image will be used.

  • maxBuckets (int) – The maximum number of buckets to use when building histograms. Will be rounded to the nearest power of 2.

Returns:

The adjusted image containing the matched source bands.

Return type:

ee.Image

Examples

import ee
import geetools

ee.Initialize()

source = ee.Image("LANDSAT/LC08/C01/T1_TOA/LC08_047027_20160819")
target = ee.Image("LANDSAT/LE07/C01/T1_TOA/LE07_046027_20150701")
bands = {
    "B4": "B3",
    "B3": "B2",
    "B2": "B1"
}
matched = source.geetools.matchHistogram(target, bands)