Measure scene illuminant using Imatest® eSFR chart
illuminant = measureIlluminant(chart)
This example shows how to measure the illuminant of an eSFR chart using the gray patch ROIs. The image of the eSFR chart is then white balanced.
Read an image of an eSFR chart into the workspace. Display the image.
I = imread('eSFRTestImage.jpg'); figure imshow(I)
Linearize the image.
I_lin = rgb2lin(I);
esfrChart object based on the linearized image, then display the chart with ROI annotations. The 20 gray patch ROIs are labeled with red numbers.
chart = esfrChart(I_lin);
Estimate the illuminant using the gray patch ROIs.
illum = measureIlluminant(chart)
illum = 69.2527 73.5922 80.5141
White balance the linearized chart image. Ideally the illuminant can be used to color balance images acquired under similar lighting conditions as the test chart.
J_lin = chromadapt(I_lin,illum,'ColorSpace','linear-rgb');
Gamma correct the white balanced image, and display the result.
J = lin2rgb(J_lin); figure; imshow(J)
The white balanced image has less of a blue tint to it, especially in the middle gray patches and over the background of the image.
illuminant— Scene illuminant
Scene illuminant, returned as a 3-element row vector.