Main Content

measureIlluminant

Measure scene illuminant using test chart

Description

example

illuminant= measureIlluminant(chart)measures the scene illuminant using the gray regions of interest (ROIs) of an Imatest®eSFR chart[1]or an X-Rite®ColorChecker®Classic chart[2].

Examples

collapse all

This example shows how to measure the illuminant of an eSFR chart using the gray patch ROIs. The example then white balances the image of the eSFR chart.

Read an image of an eSFR chart into the workspace.

I = imread('eSFRTestImage.jpg');

Create anesfrChartobject. Display the chart, highlighting the 20 gray patches.

chart = esfrChart(I); displayChart(chart,'displayEdgeROIs',false,...'displayColorROIs',false,'displayRegistrationPoints',false)

Figure eSFR test chart contains an axes object. The axes object contains 21 objects of type image, text.

使用灰色补丁roi估计光源。The illuminant has a stronger blue component than the red and green. This result is consistent with the image of the test chart, which has a blue tint.

illum = measureIlluminant(chart)
illum =1×3110.9147 116.0008 123.2339

White balance the chart image and display the result. The white balanced image has less of a blue tint, especially in the middle gray patches and over the background of the image.

J = chromadapt(I,illum); imshow(J) title('White Balanced Test Chart Image')

Figure eSFR test chart contains an axes object. The axes object with title White Balanced Test Chart Image contains an object of type image.

You can use the estimated illuminant to white balance other images acquired under similar lighting conditions.

Input Arguments

collapse all

Test chart, specified as anesfrChartobject or acolorCheckerobject.

Output Arguments

collapse all

Scene illuminant, returned as a 3-element row vector.

Data Types:double

Tips

  • To white-balance an image, use thechromadaptfunction.

  • It is recommended to measure the scene illuminant using linear image data. If you need to linearize your image data, then you can use thergb2linfunction.

References

[2]X-Rite Photo and Video. "ColorChecker Classic".https://xritephoto.com/colorchecker-classic

Introduced in R2017b