illumpca
Estimate illuminant using principal component analysis (PCA)
Syntax
Description
estimates the illumination of the scene in RGB image illuminant
= illumpca(A
)A
from
large color differences using principal component analysis (PCA).
estimates the illumination using the specified percentage of darkest and brightest
pixels.illuminant
= illumpca(A
,percentage
)
estimates the illumination using only the pixels within the ROI defined by a binary
mask.illuminant
= illumpca(___,'Mask',mask
)
Examples
Input Arguments
Output Arguments
Tips
The algorithm assumes uniform illumination and linear RGB values. If you are working with nonlinear sRGB or Adobe RGB images, use the
rgb2lin
function to undo the gamma correction before usingillumpca
. Also, make sure to convert the chromatically adapted image back to sRGB or Adobe RGB by using thelin2rgb
function.
Algorithms
Pixel colors are represented as vectors in the RGB color space. The algorithm orders colors according to the brightness, or norm, of their projection on the average color in the image. The algorithm retains only the darkest and brightest colors, according to this ordering. Principal component analysis (PCA) is then performed on the subset of colors. The first component of PCA indicates the illuminant estimate.
References
[1] Cheng, Dongliang, Dilip K. Prasad, and Michael S. Brown. "Illuminant Estimation for Color Constancy: Why spatial-domain methods work and the role of the color distribution." Journal of the Optical Society of America A. Vol. 31, Number 5, 2014, pp. 1049–1058.
Version History
Introduced in R2017b
See Also
chromadapt
| illumgray
| illumwhite
| lin2rgb
| rgb2lin