Learn R Programming

landsat (version 1.1.2)

histmatch: Histogram matching of an image

Description

Force image x to match target image by matching their histograms.

Usage

histmatch(master, tofix, mask, minval = 0, maxval = 255, by = 1)

Value

recode

The transformation table used to match the histograms.

newimage

The transformed image, in the same format in which tofix was provided.

Arguments

master

The target image, in SpatialGridDataFrame, data frame, matrix or vector format.

tofix

The image to be normalized, in any format.

mask

Areas to be omitted, if any, such as a cloud mask. Only NA values within the mask will be used.

minval

Lower bound of the possible range of values in target and tofix images.

maxval

Upper bound of the possible range of values in target and tofix images.

by

Step size to use in constructing histograms. Should be appropriate for minval and maxval of the images.

Author

Sarah Goslee

Details

The histogram of the tofix image will be forced to match that of the target image.

See Also

relnorm

Examples

Run this code
if (FALSE) {
	data(nov3)
	data(july3)
	par(mfrow=c(2,2))
	image(nov3)
	image(july3)

	nov3.newR <- relnorm(master=july3, tofix=nov3)
	image(nov3.newR$newimage)

	nov3.newH <- histmatch(master=july3, tofix=nov3)
	image(nov3.newH$newimage)
}

Run the code above in your browser using DataLab