MATCH

Histogram Matching LUT


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Example

Back to top

Description


Creates a lookup table that performs histogram matching of an input image to a master image. The output lookup table is saved to the input file and can be used by the function LUT to modify an input image.
Back to top

Parameters


match(file, dbic, mask, film, dbmc, mcmask, dblut, dbsn, dbsd, trim)

Name Type Caption Length Value range
FILE * str Input file name 1 -    
DBIC * List[int] Input raster channel 1 - 1  
MASK List[int] Area mask 0 - 4 Xoffset, Yoffset, Xsize, Ysize
FILM str Input master file name 0 -    
DBMC * List[int] Input master channel 1 - 1  
MCMASK List[int] Master area mask 0 - 4  
DBLUT List[int] Output Lookup Table 0 - 1  
DBSN str Output LUT segment name 0 - 8 Default: MATCH
DBSD str Output LUT segment description 0 - 64  
TRIM List[float] Tail trimming percentage (left, right) 0 - 2  

* Required parameter
Back to top

Parameter descriptions

FILE

Specifies the name of the input file that contains the image data to match to the master image data.

DBIC

Specifies the input channel to match to the master image channel.

MASK

Specifies the window or bitmap that defines the area to be processed within the input raster.

If a single value is specified, that value represents the channel number of the bitmap segment in the input file. Only the pixels under the bitmap are processed; the rest of the image remains unchanged.

If four values are specified, they define the x,y offsets and x,y dimensions of a rectangular window identifying the area to process. Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.

If no value is specified, the entire channel is processed.

FILM

Specifies the name of the file that contains the master image data to match against the input image data.

If this parameter is not specified, FILE is used.

DBMC

Specifies the master image channel to be matched.

MCMASK

Specifies the window or bitmap that defines the area to be matched with the input raster.

If a single value is specified, that value represents the channel number of the bitmap segment in the input file. Only the pixels under the bitmap are processed; the rest of the image remains unchanged.

If four values are specified, they define the x,y offsets and x,y dimensions of a rectangular window identifying the area to process. Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.

If no value is specified, the first quarter of the input image channel is processed.

DBLUT

DBLUT is an output parameter. Upon completion, MATCH writes the new lookup table to this channel.

DBSN

Specifies a name (up to 8 characters) for the output LUT segment.

This string is displayed by ASL and may be changed using MAS.

DBSD

Describes (in up to 64 characters) the contents or origins of the output data.

This string is displayed by ASL if LTYP is "SHORT" or "FULL", and may be changed using MAS.

TRIM

Specifies the percentage of tail trimming of the low and high ends of the input histograms from the input and master image channels.

This parameter is specified as follows:

TRIM = n1, n2
where:
Note: These are real values in units of %.

Trim sets a percentage of low-end or high-end non-zero points to zero; for example, if there are 1,000,000 pixels represented in a histogram and TRIM is set to 0.01,0.01, the 1000 lowest and the 1000 highest pixel values are set to zero.

Back to top

Details

MATCH produces a lookup table to match an input channel to a master channel. Image data on the input channel (DBIC) on the input file (FILE) is read and matched to the image channel (DBMC) on the master image (FILM). If FILM is defaulted, it is assumed that FILE contains the master channel.

The MASK and MCMASK (MasterMask) parameters specify areas of the input channel (MASK) and master channel (MCMASK) to use for matching.

If a single value is specified in each parameter, that value represents the channel number of the bitmap segment in the input file. Only the pixels under the bitmap are processed; the rest of the image remains unchanged.

If four values are specified, they define the x,y offsets and x,y dimensions of a rectangular window identifying the area to process. Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.

If no value is specified, the entire channel is processed, and one quarter of the scanlines are used.

The output lookup table is stored in the input file (FILE). MATCH creates a new lookup table segment and stores the new segment's number in DBLUT (Output: Lookup Table Layer) before exiting. The segment name (DBSN) and descriptor (DBSD) for the new output lookup table may be specified. The LUT function can use the output lookup table to modify the input image.

A lookup table is generated to map the input histogram over the entire range of output gray level values. The low and high ends of the sample may be trimmed by specified percentages (TRIM) to eliminate outliers or noise.

Back to top

Example

Create an LUT to histogram match channel 1 to channel 2, on the file "irvine.pix".

from pci.match import match

file	=	"irvine.pix"
dbic	=	[1]
mask	=	[]	# sample 1/16 of image channel
film	=	''	# defaults to FILE
dbmc	=	[2]	# match channel 1 to channel 2
mcmask	=	[]	# sample 1/16 of image channel
dblut	=	[]	# create a new LUT segment
dbsn	=	"MATCH12"	# name for the output LUT segment
dbsd	=	""	# no descriptor for output LUT segment
trim	=	[]	# default, no trimming

match( file, dbic, mask, film, dbmc, mcmask, dblut, dbsn, dbsd, trim )

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.