an1904 white balance and color correction · motorola semiconductor application note motorola, inc....

6

Click here to load reader

Upload: lethuy

Post on 29-Apr-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AN1904 White Balance and Color Correction · MOTOROLA SEMICONDUCTOR APPLICATION NOTE MOTOROLA, INC. 2000 1 1.0 Introduction White Balance and Color Correction are ... Horizon …

Order this document as AN1904/D MOTOROLA SEMICONDUCTOR APPLICATION NOTE

MOTOROLA, INC. 2000

1

1.0 Introduction

White Balance and Color Correction areprocessing operations performed toensure proper color fidelity in a captureddigital camera image. In digitalcameras an array of light detectors withcolor filters over them is used to detectand capture the image. This sensor

does not detect light exactly as thehuman eye does, and so someprocessing or correction of the detectedimage is necessary to ensure that thefinal image realistically represents thecolors of the original scene.

White Balance and ColorCorrection in Digital Cameras

Revision 1 – 10/11/00This document contains information on a new product. Specifications and information herein are subject to change without notice

Before White Balanceand Color Correction

After White Balance andColor Correction

Fre

esc

ale

Se

mic

on

du

cto

r, I

Freescale Semiconductor, Inc.

For More Information On This Product, Go to: www.freescale.com

nc

...

ARCHIVED BY FREESCALE SEMICONDUCTOR, INC. 2005

AR

CH

IVE

D B

Y F

RE

ES

CA

LE

SE

MIC

ON

DU

CTO

R, I

NC

. 200

5

Page 2: AN1904 White Balance and Color Correction · MOTOROLA SEMICONDUCTOR APPLICATION NOTE MOTOROLA, INC. 2000 1 1.0 Introduction White Balance and Color Correction are ... Horizon …

Order this document as AN1904/D MOTOROLA SEMICONDUCTOR APPLICATION NOTE

MOTOROLA, INC. 2000

2

2.0 White Balance

2.1 Definition

The white balance operation (also calledcolor balance, illuminant correction)uses the color white as the standard foradding the correct overall color ‘bias” toa captured image. The aim of this is tobasically want all white objects in thescene to be white in the image.

White balance is necessary for tworeasons:1. the sensor itself is not equally

sensitive across the visible

spectrum, consequently the color ofwhite scene objects will be shifted tohave a different hue, and

2. The human eye adjusts to thedifferent hues in illuminants, makingwhite objects appear the same colorwhite even under different coloredlights. It is necessary to have thecamera do this same adjustment orpictures will look like they have acolor cast.

2.2 White Balance Operation

The white balance operation isimplemented by making sure whiteelements in a scene appear white in theimage. Output devices such as printersand displays create the color whitewhen the individual color elementsignals are equal. In other words, whiteis created on a computer monitor whenthe RGB signals to the monitor areequal, R = G = B. The same is true forprinters. When C = Y = M, the colorwhite is created. So for a capturedimage, white balance is obtained whenthe color data signal for white sceneelements are equal. When looking atthe captured data for a white element inthe scene, if R = G = B (or equivalencein other color spaces), the image is“white balanced”. If we look at the datafor a white scene element and the colordata is not equal, we need to performwhite balance correction operation so

that the color signals are equal and theimage is white balanced. The whitebalance operation takes the form of:

Rwb = A1*RoGwb = A2*GoBwb = A3*Bo,

Where Rwb, Gwb, and Bwb is the whitebalanced output signal, Ro, Go, and Bois the R, G, and B output signals fromthe camera, before white balancing, andA1-3 are the coefficients needed toequalize the signals for the color white.Depending on whether you areperforming white balance before or aftercolor interpolation, there may be twoseparate green signals, one for each ofthe green pixels in the Bayer pattern,and a corresponding white balancecoefficient for each.

Fre

esc

ale

Se

mic

on

du

cto

r, I

Freescale Semiconductor, Inc.

For More Information On This Product, Go to: www.freescale.com

nc

...

ARCHIVED BY FREESCALE SEMICONDUCTOR, INC. 2005A

RC

HIV

ED

BY

FR

EE

SC

AL

E S

EM

ICO

ND

UC

TOR

, IN

C. 2

005

Page 3: AN1904 White Balance and Color Correction · MOTOROLA SEMICONDUCTOR APPLICATION NOTE MOTOROLA, INC. 2000 1 1.0 Introduction White Balance and Color Correction are ... Horizon …

Order this document as AN1904/D MOTOROLA SEMICONDUCTOR APPLICATION NOTE

MOTOROLA, INC. 2000

3

2.3 White Balance Implementation

White balance can be implemented as apost-processing step. The whitebalance coefficients needed to equalizethe color signals in response to a whitescene are computed. The color signalsare multiplied by these coefficients andthe resulting image is white balanced.This will need to be done for eachimage captured.

In the Motorola ImageMOS™ arrays,white balancing can be done byindividually adjusting the color channelgains for each color signal. Thiseliminates the need for post-processingof the image. The white balancecoefficients are turned into equivalentcolor channel gains, which adjust thecolor signals before exiting the sensorarray chip.

The challenge of white balance is indetermining what the color channelcoefficients or gains should be. Atypical way of accomplishing this is tocapture an image of a white (or grey,grey is just a “shade” of white) card orother white element, and examining thecamera output. The proper coefficientsor channel gains are computed whichmake the color signals equal whencapturing the white card.

There are several problems with this.White balancing needs to be done foreach different illuminant used. Acamera which is white balancedoutdoors will not be white balancedunder indoor illumination, and viceversa. Also most camera users do notwant to have to bother to capture whitecard images and go through the whitebalance procedure at all, even ifinfrequently needed. So cameras needto have a way of automatically whitebalancing themselves. To accomplishthis many cameras have white balancealgorithms used to determine the whitebalance coefficients, or settings fordifferent standard illuminants, which canbe programmed into the camera.

Motorola’s ImageMOS™ sensorssupport any of these white balanceimplementations. White balancing canbe done as a post-processing step, orcolor channel gains can beprogrammed. White balancecoefficients or color channel gains canbe controlled by an automatic whitebalance algorithm and updatedconstantly if desired. Motorola hascompanion chips and algorithmsdeveloped for this purpose if needed.

2.4 White Balance Coefficients for Standard Illuminants

The following tables gives white balancecoefficients and color channel gainvalues for some typical illuminants. Oneor the other of these can be used in yoursystem to perform basic whitebalancing. These settings are for usewith Motorola RGGB ImageMOS™sensor arrays. These settings,however, are only approximate and

are for specific lamps used inMotorola’s laboratories. Thesevalues change when different IRfilters are used, and when theilluminant spectrums differ fromthose in the table. No guarantees areprovided that these settings willwhite balance your output images inyour specific application. .

Fre

esc

ale

Se

mic

on

du

cto

r, I

Freescale Semiconductor, Inc.

For More Information On This Product, Go to: www.freescale.com

nc

...

ARCHIVED BY FREESCALE SEMICONDUCTOR, INC. 2005A

RC

HIV

ED

BY

FR

EE

SC

AL

E S

EM

ICO

ND

UC

TOR

, IN

C. 2

005

Page 4: AN1904 White Balance and Color Correction · MOTOROLA SEMICONDUCTOR APPLICATION NOTE MOTOROLA, INC. 2000 1 1.0 Introduction White Balance and Color Correction are ... Horizon …

Order this document as AN1904/D MOTOROLA SEMICONDUCTOR APPLICATION NOTE

MOTOROLA, INC. 2000

4

Illuminant White Balance CoefficientsRed Green (of Red) Green (of Blue) Blue

Daylight 65 1.32 1.02 1.0 1.2Horizon 1.0 1.3 1.42 2.74

Cool WhiteFluor.

1.3 1.0 1.0 1.6

U30Fluorescent

1.0 1.0 1.1 2.1

Incandescent‘A’

1.0 1.18 1.26 2.2

Table 1. RGGB ImageMOS™ Example White Balance Coefficients

When writing to the ImageMOS™ VGAsensor (MCM20014) in particular, thevalues that have to be written to thesensors color gain registers are asfollows:

Illuminant Color Channel Gain Settings (hex)Red Green (of Red) Green (of Blue) Blue

Daylight 65 04 00 00 02Horizon 00 04 06 A0Cool WhiteFluor.

04 00 00 09

U30Fluorescent

02 02 02 0F

Incandescent‘A’

00 03 04 17

Table 2. RGGB ImageMOS Example Color Channel Gain Values for White Balance

Fre

esc

ale

Se

mic

on

du

cto

r, I

Freescale Semiconductor, Inc.

For More Information On This Product, Go to: www.freescale.com

nc

...

ARCHIVED BY FREESCALE SEMICONDUCTOR, INC. 2005A

RC

HIV

ED

BY

FR

EE

SC

AL

E S

EM

ICO

ND

UC

TOR

, IN

C. 2

005

Page 5: AN1904 White Balance and Color Correction · MOTOROLA SEMICONDUCTOR APPLICATION NOTE MOTOROLA, INC. 2000 1 1.0 Introduction White Balance and Color Correction are ... Horizon …

Order this document as AN1904/D MOTOROLA SEMICONDUCTOR APPLICATION NOTE

MOTOROLA, INC. 2000

5

3.0 Color Correction

3.1 Definition

Color Correction (also called saturationcorrection or color saturation) is anadditional processing step which “tunes”image colors so they replicate scenecolors. Color correction is necessarybecause the basic filter sets used on

digital cameras do not match the color“filters” in the human eye. The colors incaptured images usually need to bemade more “saturated”, which gives amore brilliant look to colors.

3.2 Color Correction Operation

Color correction is another mathematicaloperation performed on the outputsignals. In its most common form, colorcorrection takes the form of a 3 X 3matrix operation:

Rcc = A11*Ro + A12*Go + A13*BoGcc = A21*Ro + A22*Go + A23*BoBcc = A31*Ro + A32*Go + A33*Bo

Where Rcc, Gcc, and Bcc is the colorcorrected output signals, A11 – A33 arethe matrix coefficients for the colorcorrection matrix, and Ro, Go, and Bo arethe camera output signals (which may ofalready undergone other processingsteps such as white balance).

The challenge of color correction is, ofcourse, to determine the color correctionmatrix coefficients. The matrix

coefficients are computed by amathematical mapping of the sensorresponse function onto the colormatching function of the output device.The matrix coefficients change fordifferent lenses and IR filters used, fordifferent output devices such asmonitors and printer, and for differenttypes of sensors and color filter options.The matrix coefficients are thereforevariable under different applications andhardware usage.

Motorola has determined that thefollowing color correction matrix maywork with Motorola’s ImageMOS™sensors under many applications. Thismatrix is provided as an example onlyand does not ensure it will work for yourparticular case.

A11 = 1.1809 A12 = -0.0951 A13 = -0.1355

A21 = -0.2441 A22 = 1.2961 A23 = -0.0519

A33 = 1.7144 A31 = -0.1807 A32 = -0.4453

Table 3. ImageMOS™ Example Color Correction Matrix Coefficients

Fre

esc

ale

Se

mic

on

du

cto

r, I

Freescale Semiconductor, Inc.

For More Information On This Product, Go to: www.freescale.com

nc

...

ARCHIVED BY FREESCALE SEMICONDUCTOR, INC. 2005A

RC

HIV

ED

BY

FR

EE

SC

AL

E S

EM

ICO

ND

UC

TOR

, IN

C. 2

005

Page 6: AN1904 White Balance and Color Correction · MOTOROLA SEMICONDUCTOR APPLICATION NOTE MOTOROLA, INC. 2000 1 1.0 Introduction White Balance and Color Correction are ... Horizon …

Order this document as AN1904/D MOTOROLA SEMICONDUCTOR APPLICATION NOTE

MOTOROLA, INC. 2000

6

3.3 Color Correction Implementation

There are many other implementationsof color correction. In many cases it isnot necessary to use a 3 X 3 matriximplementation. Simpler forms of colorcorrection may be used. In other casesmore complex, non-linear colorcorrection methods may be warranted.

In digital cameras programmable orvariable color correction means aresometimes implemented. Motorola hascompanion chips and algorithms, whichwork with the ImageMOS™ sensorarrays for this purpose if needed.

Fre

esc

ale

Se

mic

on

du

cto

r, I

Freescale Semiconductor, Inc.

For More Information On This Product, Go to: www.freescale.com

nc

...

ARCHIVED BY FREESCALE SEMICONDUCTOR, INC. 2005A

RC

HIV

ED

BY

FR

EE

SC

AL

E S

EM

ICO

ND

UC

TOR

, IN

C. 2

005