Slide 1 of 30
Color Calibration and Correction Procedures for Color Imaging Devices
“Image Analyst”
Color Science Specialist Image Processing Expert
Feb. 11, 2008
Slide 2 of 30
Why might two systems have different colors?
• Cameras may have different spectral responsivities – Might be due to different manufacturing
batches or different ambient operating temperatures
• Lamps may have different spectral emittances (color temperatures)
• Digitizers may be different • Any of these may change over time
Slide 3 of 30
Two different concepts
• Color Correction – matching to a gold standard system – RGB to RGB
• Color Calibration – e.g. conversion to Lab color space – RGB to Lab
Slide 4 of 30
Color Correction
• Correction of an image to a “gold standard” image.
• Change the color intensities reported by your color imaging system so that they match those snapped at some initial time-point (same system), or to another system (the “gold standard” system).
• I also call this “RGB Matching”
Slide 5 of 30
Color Correction
• This can be done in color or monochrome. • Image from your “sample” system will be
changed into what it would look like if it were snapped on your standard system.
• Standard system can be time-point zero on the same system, another system, or an average of several systems.
Slide 6 of 30
Color Calibration
• Calibration to a known standard, such as the Macbeth Color Checker Chart
• Develop transforms that will convert your system’s RGB values from your color imaging system into colorimetric color values (e.g. XYZ, LAB, or HSI) that will match those produced by a calibrated colorimeter or spectrophotometer.
Slide 7 of 30
How Many Chips Do I Need?
• Color charts – Around 24 color chips for color application
• Monochrome charts – Around 8-16 chips if monochrome
• Adding more chips doesn’t improve accuracy for shades that are not one of the standard shades
Slide 8 of 30
How Many Terms Do I Need?
• Terms in your transform equation – Rcorrected = F(R, R2, R3, R4, etc.)
• Go to third order in R, G, and B – Adding additional higher order terms doesn’t
help improve accuracy for off-standard colors – For example, a cubic equation is about as
accurate as a 10th order equation
Slide 9 of 30
What about Background Correction?
• Color correction is best when done after background correction.
• Color calibration must be done after background correction, and after color correction (if done)
Slide 10 of 30
Background correction • Only done for flat surfaces unless you have a blank shape
(for example, clean white bowl) • Take picture of neutral (white) sample. • Remove temporal video noise by blurring • Can remove blank sample imperfections by blurring or
taking average of two rotated images • Calculate a “percentage image” where each pixel is the % of
the maximum pixel intensity in the image • Divide your raw images by your percentage image to get a
flat field background corrected image • Intuitive example: If your image is 90% as bright at the
corner as at the middle, then you need to divide the corner by 90% to get it to look like the middle
Slide 11 of 30
You can do both Correction and Calibration
• It is possible to do either and/or both – they are independent.
• If you’re going to do both, you would background correct and color correct the image first before calibrating it to known LAB standards.
Slide 12 of 30
Example: Color system
• Does both color correction and color calibration
• Does white balancing first • Then does background correction • Then does RGB color correction • Follows with RGB-to-LAB color calibration
Slide 13 of 30
Example: Gray scale system
• Only gray scale correction to a gold standard system.
• Look at gray level step wedge and compare to standard.
• Cubic spline interpolation to form a Look Up table that we can apply to the sample image to map it into a standard image.
Slide 14 of 30
Color Correction
• Image the Macbeth chart then… • For chip #1: • And so on for the rest of the chips: • For chip #2: • For chip #3: • etc. • For chip #24: • You can go to higher orders (R3, G3, B3) or have
cross terms (RG or GB) if you wish.
216
215
21413121101 BGRBGRGoldR ααααααα ++++++=
2246
2245
2244243242241024 BGRBGRGoldR ααααααα ++++++=
236
235
23433323103 BGRBGRGoldR ααααααα ++++++=
226
225
22423222102 BGRBGRGoldR ααααααα ++++++=
Slide 15 of 30
Solve for the α’s
• Plug in the known gold standard values, the “true” values you are shooting for
• Plug in the measured values from your test system
• Do a least squares regression to solve for the α’s
• Now you have a function that converts a R, G, and B value into an estimated Gold Standard R
Slide 16 of 30
Do the same for G and B
• You have similar sets of 24 equations for G and B except that you plug in the gold standard G and B values.
• Solve for the β’s to get the equation (estimated gold G) = F(Rmeas, Gmeas, Bmeas)
• Solve for the γ’s to get the equation (estimated gold B) = F(Rmeas, Gmeas, Bmeas)
Slide 17 of 30
3 equations for correction
• Now you have 3 equations • One to get estimated R • One to get estimated G • And one to get estimated B • Apply all 3 to get the new estimated gold
standard color
Slide 18 of 30
The final formulas : RGB to RGB • Can apply with LUT if no cross channel colors
(for example, red just depends on red and not on green and blue), otherwise do it pixel-by-pixel
26
25
243210 BGRBGREstimatedR ααααααα ++++++=
26
25
243210 BGRBGREstimatedG βββββββ ++++++=
26
25
243210 BGRBGREstimatedB γγγγγγγ ++++++=
Slide 19 of 30
Color Calibration
• Calibration to known CIE Standards – The Lab’s of the Macbeth Chart or similar
standard • Same process as before except that you
put in the known, true L, a, or b values instead of the Rgold, Ggold, or Bgold values
• L, a, b values taken from instrument such as spectrophotometer
Slide 20 of 30
When to calibrate • Stable system: One calibration image for all your
samples/subjects in this session. All images corrected in the same way according to this one chart.
• For utmost accuracy: have a color chart embedded in each image. Each image is corrected according to its own chart.
• “Stable” is defined over the time period in which you want to compare different samples. For example a half an hour if you just want to compare glasses with others washed that day, or weeks for longitudinal clinical studies.
Slide 21 of 30
Color Calibration
• Image the Macbeth chart then… • For chip #1: • And so on for the rest of the chips: • For chip #2: • For chip #3: • etc. • For chip #24: • You can go to higher orders (R3, G3, B3) or have
cross terms (RG or GB) if you wish.
216
215
21413121101 BGRBGRL ααααααα ++++++=
2246
2245
2244243242241024 BGRBGRL ααααααα ++++++=
236
235
23433323103 BGRBGRL ααααααα ++++++=
226
225
22423222102 BGRBGRL ααααααα ++++++=
Slide 22 of 30
Solve for the α’s
• Plug in the known L values, the “true” values you are shooting for
• Plug in the measured RGB values from your test system
• Do a least squares regression to solve for the α’s (These are different than the color correction α’s)
• Now you have a function that converts an R, G, and B value into an estimated L value
Slide 23 of 30
Do the same for A and B
• You have similar sets of 24 equations for A and B except that you plug in the gold standard A and B values.
• Solve for the β’s to get the equation (estimated A) = F(Rmeas, Gmeas, Bmeas)
• Solve for the γ’s to get the equation (estimated B) = F(Rmeas, Gmeas, Bmeas)
Slide 24 of 30
3 equations for correction
• Now you have 3 equations • One to get estimated L • One to get estimated A • And one to get estimated B • Apply all 3 to get the new estimated
colorimetric values
Slide 25 of 30
The final formulas: RGB to LAB • Can apply with LUT if no cross channel colors
(for example, red just depends on red and not on green and blue), otherwise do it pixel-by-pixel
• These are different α’s, β’s, and γ’s than we used with the RGB color correction.
26
25
243210 BGRBGREstimatedL ααααααα ++++++=
26
25
243210 BGRBGREstimatedA βββββββ ++++++=
26
25
243210 BGRBGREstimatedB γγγγγγγ ++++++=
Slide 26 of 30
What about going to XYZ?
• You can go from RGB to XYZ first, then use analytical formulas to get the LAB from the XYZ
• As long as you’re within your training set, there should be no difference in accuracy, being about the same number of delta E units for either way.
• If you might have values outside your training set (brighter or darker than any chip) then go to XYZ first, then LAB to avoid extrapolation errors.
• Going directly to LAB is simpler
Slide 27 of 30
Back to Color Correction • How do I apply the transform?
– From sample image into estimated “gold” image • Can use specially written software (a DLL) that
gets a new R, G, and B value for each pixel – Process image one color band at a time.
• Can apply a look up table (LUT) – For monochrome, no problem – For color, LUT method works only if you have single
no cross channel terms. For example, new red only depends on old red and not on green and blue.
Slide 28 of 30
Monochrome Correction
• If you change systems (cameras, lamps, etc.) you may change the intensity response of your system. – A glass that had a filming level of 88 gray
levels may now be at 103 gray levels. • If you need the utmost accuracy, try a
spline LUT rather than a regression – (Explanation on next slide)
Slide 29 of 30
Remap your image’s intensities • Play around with polynomial vs. cubic splines at
http://www.wam.umd.edu/~petersd/interp.html • Plot of (Standard Gray Level) vs. (new system gray level) would be 45
degree line if new system perfectly matched old system
New system gray level
Sta
ndar
d gr
ay le
vel
Want to map your new values into standard values
Slide 30 of 30
Summary
• Exposure and color differences are a fact of life and for the utmost accuracy you need to correct for them.
• First snap a neutral scene then use it to do background correction.
• Then snap a color chip chart and use it to do RGB-to-RGB color correction.
• Then convert the RGB values into Lab values to have calibrated colors.