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 a Calibrite 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 an esfrChart object. 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.

Estimate the illuminant using the gray patch ROIs. 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×3

  110.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")

Figure eSFR test chart contains an axes object. The axes object with title White Balanced Test Chart 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 an esfrChart object or a colorChecker object.

Output Arguments

collapse all

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

Data Types: double

Tips

  • To white-balance an image, use the chromadapt function.

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

References

[2] Calibrite. "ColorChecker Classic". https://calibrite.com/us/product/colorchecker-classic/.

Version History

Introduced in R2017b

expand all