Dichromatic parameter recovery routine
Contents
Syntax:
[k, g, K, S] = recover_dichromatic_parameters(I, L);
[k, g, K, S] = recover_dichromatic_parameters(I, L, options);
Description:
This function recovers the photometric parameters in the context of the
dichromatic reflection model given by

where the illuminant power spectrum is given by L, g is the shading
factor, S is the surface reflectance, k is the specular coefficient and
K represents the specular highlights.
Input:
I: A radiance image stored as a 3D array of size height x width x bands.
L: The illuminant power spectrum, stored as a 1D vector of size 1 x bands. If L is not given,
it will be estimated by calling the recover_global_illuminant function.
options: Structure with the following fields
method: String specifying the method to be used. This can be
'LS' for the linear least squares solver,
'KL' for the energy minimization method, or
'TI' for the method of Tan and Ikeuchi (only available for win64 Matlab versions).
neigbourhoodsize (optional, used by the LS option): Threshold used to ignore the processing of
regions with a small number of pixels. Those with a number of pixels smaller than or
equal to neigbourhoodsize are ignored (default value is 5).
grayThresh: (optional, used by the LS option): Threshold used to determine whether a material
is a shade of gray. If the reflectance spectra within a cluster does not deviate from a
uniform spectrum (a flat line) beyond this threshold, then its assumed that it is a shade of
gray and purely diffuse (default value is 2);
numclusters: (option, used by the KL option): the number of clusters used for the K-means. The
default is 20.
DEBUG: Defines the amount of debugging information provided at processing time (default is 1).
Output:
K: The wavelength dependant specularity per pixel, stored as a 3D array of size height x
width x bands.
S: The normalised reflectance cube per pixel, stored as a 3D array of size height
x width x bands. The reflectance spectrum at each pixel is normalised to a unit L2-norm.
k: The specular coefficient per pixel. k is stored as a 2D array of size height x width.
g: The shading factor per pixel. g is stored as a 2D array of size of height x width.