geetools.Image.ImageAccessor.matchHistogram#

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

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

Parameters: target: Image to match. bands: A dictionary of band names to match, with source bands as keys and target bands as values. geometry: The region to match histograms in that overlaps both images. If none is provided, the geometry of the source image will be used. maxBuckets: 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.

Parameters:
  • target (ee.Image)

  • bands (dict)

  • geometry (Optional[ee.Geometry])

  • maxBuckets (int)

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.matchHistogram(target, bands)