LabKit MATLAB Workbench

reference

API ReferenceImage Match

image_match.analysisRun.applyMatch

Transfer reference appearance statistics to one image.

Syntax

outputImage = image_match.analysisRun.applyMatch( ... inputImage, referenceImage, step)

Description

Converts the source and reference to RGB double images, transfers the selected tone and color statistics from the reference, and blends the matched result with the source. Matching never registers, crops, or resizes either image; only appearance statistics are transferred. The source geometry therefore determines the output geometry.

Inputs

inputImage
Numeric or logical grayscale, RGB, or multichannel source image. It is converted to M-by-N-by-3 double data in [0,1].
referenceImage
Numeric or logical reference image. Its dimensions may differ from inputImage because matching uses image-wide statistics. Empty input returns the normalized source unchanged.
step
Scalar structure created by image_match.analysisRun.makeStep.

Step Fields

matchMethod
One label returned by image_match.imagePreview.presentationData.matchMethods. Punctuation and spaces are ignored when matching labels. An unknown or empty value uses "Balanced".
amount
Overall blend percentage. Zero returns the source; 100 returns the selected matched result. Values are limited to [0,100].
secondary
Tone-match percentage, limited to [0,100].
colorStrength
Color-match percentage, limited to [0,100].

Match Methods

Balanced
Applies robust white-balance gains, then Lab tone quantile and a/b covariance matching. White balance - Matches robust bright neutral RGB channel ratios only. Tone only - Quantile-matches Lab lightness; colorStrength is unused. Protected tone - Moves background lightness and color toward the reference while limiting changes in saturated subject regions. Lab style - Quantile-matches Lab lightness and covariance-matches the Lab a/b color channels.
Histogram
Quantile-matches all three Lab channels independently.

Outputs

outputImage
M-by-N-by-3 double image in [0,1], with the same height and width as inputImage.

Failure Behavior

Empty referenceImage returns normalized inputImage unchanged. Missing step fields use the App's match defaults; unsupported image classes/channel shapes or malformed numeric step values propagate the originating LabKit image or MATLAB calculation error.

Example

source = cat(3, 0.3*ones(8), 0.5*ones(8), 0.8*ones(8));
reference = cat(3, 0.8*ones(6), 0.5*ones(6), 0.3*ones(6));
step = image_match.analysisRun.makeStep("White balance", 100, 100, 100);
outputImage = image_match.analysisRun.applyMatch(source, reference, step);
assert(isequal(size(outputImage), [8 8 3]))

Source

This page is generated from the MATLAB help text in apps/image_measurement/image_match/+image_match/+analysisRun/applyMatch.m.