Colour Correction with a colour passport basics

9 views (last 30 days)
I am measuring the change of vegetation indicies over time so I am taking a picture every day. Unfortunately the light cant be the same every single time and so i would need to do some colour correction on the images before processing the indicies. I have an image taken with a colour passport in it (attached) and i was wondering how to go about doing the colour correction. I have attached the data sheet for the colour passport as well. Would it be a case of identifying the region in the photo and finding the ratio between the expected RGB values from the data chart and the values in the photo?

Answers (1)

Image Analyst
Image Analyst on 25 Jun 2020
Edited: Image Analyst on 25 Jun 2020
I do this all the time. Calibrated color measurement is my specialty as you might guess from my avatar.
It looks like you have the x-Rite Color Checker Classic, not the passport. And certainly not the DataColor chart from the PDF you attached - I mean, that one doesn't even have the same number and color of chips on it!
Bascially you have to identify the chart's chips locations. The best way is to just have the chart and camera on a jig where they are in the same location all the time. Then you can read the RGB values right from known row/column locations. If you can't do that and it moves all over each time, then you have to find the chips. First you have to convert to HSV color space and look for highly saturated regions. Now to distinguish between chips and leaves you'll have to find the leaves. You can do that by looking for the black frame of the chart and excluding everything outside of that. Now you'll have to do certain things to make sure you find the centroid of every chip. If you can assume the chart is fairly aligned with the image edges, then you can simply use kmeans() and then add a row for the neutral colored row, which doesn't show up in the thresholded saturation image. If it's tilted, you'll have to use fitPolynomialRANSAC().
The next step is to read the RGB colors of the chips in the order that your reference table has them, which is not necessarily the order in which regionprops() finds them. So there is some reordering you will need to do.
So now you have the RGB value of the chips and you need to develop a transform to convert RGB values into LAB values. I'm attaching a Powerpoint tutorial on that. Basically you should convert the reference LAB to reference XYZ, then pick a model, like cross channel quadratic, and use least squares to determine a transform to go from RGB to XYZ. You go to XYZ instead of LAB because if you have white in your image that is brighter than the white color chip, it won't predict the correct value if you just go immediately straight to LAB (long story, just trust me). Then you can use analytical equations to go from XYZ to LAB. Now once you have the image in LAB color space, you can compare it to the time zero image and get the Delta E color differences.
Note, you'll have to do a background correction before you do anything else. This is because the exposure will not be uniform. Not only might there be illumination variation over the field of view but all cameras produce shading on the image, mostly due to the lens. For example, you may have only 80% the brightness at the corner as you do at the middle, and you have to correct for that. Don't do a background subtraction like novices will recommend to you. You need to do a background division, not subtraction. Why? Well if the light at the corner is only 0.8 as bright as the middle, what do you need to do? You need to divide it by 0.8 to bring it up to what it should be, right?
Why do you need to do background correction? Well you don't want different colors for an object depending on where it is in the field of view do you? If you have the same color and just move it from the middle to the corner it will have a different RGB value and it you don't correct for that then you'd get a different calibrated LAB value.
Anyway, look over the attachment for more info. I've left out a lot of real world considerations, even in the attachment. To explain everything to you I'd need about a full day or even two. But this should get you started.
  21 Comments
María da Fonseca
María da Fonseca on 26 Aug 2022
Hi!
Does anyone know the selection criteria for the 24 colors of the x-Rite Color Checker Classic?
María
Image Analyst
Image Analyst on 27 Aug 2022
They picked a gray scale selection, for obvious reasons. And then they wanted colors out near the extremes of the color gamut so that's why they have the 4 "pure" RGBMCY colors which are as vivid and saturated as they can get. Then for the other 6 they tried to pick 6 colors from natural scenes and photographs that sort of evenly sampled the 3-D gamut. By the way, x-rite sold the color chart product line to Calibrite.com.

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!