SI2100 Manaul R1

advertisement
Silicon Imaging
SI-2100 USB2.0 MegaCamera
2.0 Million Pixel Progressive Scan Digital Camera
Revision 1.0
November 26, 2004
2.0 Million Pixels
1600 x 1200 Image Sensor
4.2 um Square Pixel
½ Optical format
Rolling Shutter
SVGA (800x600) Subsampling
10~40 Frames per Second
10 Bit Digital Sampling
RGB Bayer Color
Auto White Balance
Auto Exposure Control
USB2.0 Interface
**** Company Confidential ****
 Silicon Imaging , Inc. 2003
Page 1 of 25
Company Confidential
MegaCamera™ SI-2100RGB
Silicon Imaging Inc.
2.0 Megapixel, 10-Bit, 40MHz
USB 2.0 Smart Color Digital Camera
INTRODUCTION
Silicon Imaging is proud to continue its innovation in high-resolution
color vision camera. Driven by the growing demand for consumer Digital
Still Cameras, CMOS sensors are continuing to break technical barriers
and surpass the performance characteristics of CCD’s in many photonic,
imaging and consumer applications. By utilizing a single highly integrated
CMOS device, which incorporates Megapixel sensing areas, timing
generation, signal processing and high bandwidth outputs, Silicon Imaging
has developed a very compact, low-power, ultra high speed Megapixel
digital camera system.
1600 x 1200 Megapixel - Ultra Resolution
The SI-2100 is an all-digital CMOS camera that delivers 2.0 Million pixels
of resolution and is capable of running at 12 frames/second at its full 1600
x 1200 resolution. The entire package is only 45 x 52 x 50mm (33 x
40mm x 22mm in PCB) and is small enough to placed on a robot for
semiconductor machine vision inspection or placed in an outdoor housing
for remote surveillance. It is ideal for live visualization of documents or
films and scanning of biometrics for handprint or facial recognition.
10-Bits Sampling – Sub-Pixel Accuracy
The SI-2100 MegaCamera uses 10-Bit digitizers to sample the pixel
data. Converting the pixel data directly to digital at the sensor head
eliminates pixel-sampling jitter and enables accurate sub-pixel metrology,
image analysis and improved live video reconstruction. A programmable
clock which ranges from 10~40MHz allows for trade-offs in speed versus
exposure time and lower noise.
40 FPS SVGA Windowing - Fast Preview
Ideal for high speed preview and focusing, the SI-2100 is capable of
generating imagery at over 40 frames per second by reducing the size of
the readout image in color subsampling mode, This entire imager is
readout by skipping pairs of pixels (4:2) to maintain color information of
neighboring bayer groups. In this way, the 800x600 accurately represents
the full size 1600x1200 image.
Automatic Color & Exposure Processing
The SI-2100 has built in Automatic White Balance, Automatic Exposure
and Automatic Gain Controls. As lighting conditions vary, the camera will
automatically adjust the exposure and gain in combination to obtain an
image with a target brightness range, on a frame-by-frame basis. It also
analyzes the distribution of RGB values in the scene and adjusts individual
channel gains to maintain white balance. For controlled lighting and
inspection applications, gain and exposure values can be set manually via
simple commands and software presets.
USB 2.0 High-Speed Interface
The high-speed image capture and connectivity is undergoing a revolution. The
new UBS2.0 standard allows you to connect megapixel vision cameras with a
single 4-wire cable directly into a 480Mbit/sec (megabits per second) port,
found in every new motherboard produced with Intel P4 chipsets. These
new USB 2.0 vision cameras can transfer precision 8 or 10-bit digital gray scale
or color image data, eliminating the sampling jitter of traditional analog RS-170
or NTSC systems, at speeds 40x faster than the predecessor USB1.1
devices. This interface also provides bi-directional serial communication for
camera setup and control, triggering, strobing and other I/O signaling. One of
the most convenient benefits, especially for those imaging executives and sales
engineers traveling with the latest lightweight laptops, is not having to carry an
additional power supply; these cameras are powered thru the same USB
cable. For the vision system end-user, the benefit will be a lower system cost
than previous camera and frame grabber solutions and plug-n-play installation.
 Silicon Imaging , Inc. 2003
Page 2 of 25
FEATURES
·
1600 x 1200 Resolution (2.0 Million Pixels)
·
1/2” Imaging Format , 4.2um Square Pixel
·
Rolling Shutter, Progressive scan
·
800 x 600 SVGA Windowing at 40fps
·
10 Bits per Pixel, 40MHz Sampling
·
10 ~ 40MHz Programmable Clock
·
Optical black level calibration
·
Programmable Gain, Exposure & Clocks
·
Auto Exposure and Gain Control (AEC/AGC)
·
Auto White Balance Control (AWB)
·
Color Bayer RGB Model
·
33 x 40mm x 22mm PCB Version
·
USB Interface & Bus Powered
·
C-Mount Precision Machined Housing
Company Confidential
Camera Architecture Overview
The MegaCamera SI-2100 consists of 6 major component sections, which are built on two circuit boards.
1.) 2.0 Megapixel Sensor
2.) Digital Clock Synthesizer
3.) Digital Control Logic
4.) Microprocessor
5.) USB Interface
6.) Power Regulation
7.) Trigger & Strobe Controls
Register
Programming
Digital
Logic
Strobe Out
DATA (10)
FVAL
LVAL
CLOCK
Trigger
Controller
Trigger In
Image
Sensor
&
A/D
Converter
uP
Control
USB 2.0
5VDC
Power
Supply
PLL & Timing
Generator
SI-2100 Camera Block Diagram
PCB OEM Version
44 x 33 x 14mm - 2PCB
Actual size
 Silicon Imaging , Inc. 2003
Page 3 of 25
Company Confidential
1.)
2.0 Megapixel CMOS Image Sensor (1600 x 1200)
The MegaCamera SI-2100 utilizes a proprietary 2.0 Million pixel high-speed CMOS image sensor. Each pixel is
4.2um square, ideal for image processing, and the entire array fits the 1/2” format for flexible optic choices. This
reduction in process geometry allows for both an increase in transistors and fill factor without compromising
performance, plus offers more advanced readout controls, greater speeds and lower power dissipation. This new
sensor technology offers a more responsive pixel design with added circuitry for increased dynamic range, greater
sensitivity, decreased fixed pattern noise and low dark current for long exposure applications. Unlike CCD, which
leak charge to adjacent pixels when the registers overflows (blooms), the SI-2100 provides inherent anti-blooming
protection in each pixel, so that there is no blooming.
The array has 1600 pixels on a line and 1200 rows, which result in a 4:3 aspect ratio. The sensor array design is
based on a field integration read-out system with line-by-line transfer and an electronic shutter with a synchronous pixel readout scheme (aka. Rolling Shutter Method)
Analog Gain Amplifier & Color Balance
When the column sample/hold circuit has sampled one row of pixels, the pixel data will shift out one-by-one thru
an analog amplifier with Global Gain. The amplifier gain can either be manually programmed by the user or controlled by the
internal automatic gain control circuit (AGC). The amplified signals are then color balanced with a channel balance block. In
this block, the Red/Blue channel gain is increased or decreased to match Green channel luminance level. The adjustment
range is +54 dB. Red/Blue Channel Balance can be done manually by the user or by the internal automatic white balance
(AWB) controller.
10-Bit A/D Conversion
The balanced signal is then digitized by the on-chip 10-bit ADC. It can operate at 40 MHz and is fully synchronous to
the pixel clock. The actual conversion rate is determined by the programmable clock rate.
Black Level Compensation
After the pixel data has been digitized, black level calibration can be applied before the data is output. The black level
calibration block subtracts the average signal level of optical black pixels to compensate for the temperature and exposure time
generated dark current in the pixel output. The user can disable black level calibration.
RGB Bayer Digital Output
The color balanced and black level corrected data is output from the sensor in 10-bit raw Bayer Digital format and
fed through the programmable logic to the USB2.0 High-Speed Interface.
 Silicon Imaging , Inc. 2003
Page 4 of 25
Company Confidential
SI-2100 Sensor Specifications
Lens Size
1/2"
Pixel Size
4.2 µm x 4.2 µm
Array Size
1600 x 1200
Image Area
6.72 mm x 5.04 mm
A/D Resolution
10-Bits
Output Format
8/10-bit digital raw RGB Bayer Data
Color Subsampling
800 x 600 (SVGA)
4:2 Subsampling
Transfer Rate
UXGA: 10 fps
SVGA: 40 fps
Scan Mode
Progressive
Dark Current
28 mV/s
S/N Ratio
54 dB
Fixed Pattern Noise
< 0.03% of V PEAK-TO-PEAK
Dynamic Range
60 dB (due to ADC limitations)
Electronics Exposure
UXGA Up to 1230:1
SVGA Up to 614:1
Gain Control
Global Gain: 1x ~ 8x
Blue Gain: 1/5 x ~ 5x
Red Gain: 1/5 x ~ 5x
Auto White Balance (AWB)
Manual / Automatic
AWB Threshold, AWB Speed
Auto Exposure Control (AEC)
Manual / Automatic
AEC Target Min/Max, AEC Speed/Steps
Histogram Counters
R/Gr/Gb/B Channel Average
Luminance Average
 Silicon Imaging , Inc. 2003
Page 5 of 25
Company Confidential
SI-2100 Spectral Response Curve
2.)
10-Bit Digital Sampling System
A 10-Bit Analog-to-digital (A/D) converter samples each pixel value and quantizes it into 1024 levels inside the
sensor. Pixel clock sampling ensures precise measurement of the photonic charge without the jitter and sampling
uncertainty associated with traditional analog video systems, such as RS-170 and CCIR. The produces images
which can deliver improved photometry accuracy and sub-pixel metrology. The use of 10-bit converters versus
traditional 8-bit systems further enhances the image dynamic range. The combination of 10-bit vertical resolution
and pixel clock sampling provide precise sub-pixel measurement accuracy (ex. 1/10 pixel).
3.)
Digital Clock Synthesizer
A wide range a master clock frequencies (eg. 10 to 40MHz) can by precisely generated using the Digital Clock
Synthesizer. The frequency of the clock synthesizer can be set by vendor command. A table with associated clock
frequency is found in the serial programming section of the manual. Due to frequency restriction on the digital
transmission link and processor clocks, the pixel clock frequency cannot be lower than 5Mhz or higher than
50MHz. In 10-bit mode, the sustained data rate on the USB2.0 is up 2x the pixel clock rate. In order to maintain
full 10-bit resolution the clock rate needs to be reduced to half the maximum. Alternatively, the camera is capable
of switching to 8-bit mode and the clock rates increased.
4.)
Embedded Microprocessor
A microprocessor in the camera provides the control interface between the PC and the functional block in the
camera (Sensor, Clock Synthesizer, Register Memory, triggers & USB Interface. The Microprocessor receives
commands thru the USB interface and issues commands to the other internal devices. It also can store preset
values for camera setting, which can be recalled.
 Silicon Imaging , Inc. 2003
Page 6 of 25
Company Confidential
5.)
USB2.0 Interface & Power
The UBS2.0 interface connect the camera to the PC with a single 4-wire cable. The port provides sustained data
rates of over 40MB/sec and also provides +5VDC to the camera for operation. The interface also provides bidirectional serial communication for camera setup and control, triggering, strobing and other I/O signaling.
6.) Camera Control Signals & Power
Several digital I/O and power signals are available on the processor from PCB header points for custom OEM
applications.
 Silicon Imaging , Inc. 2003
Page 7 of 25
Company Confidential
Digital Clock Synthesizer Programming
The SI-2100 has a Digital Clock Synthesizer capable of generating a range of frequencies from 10MHz to 40MHz.
The pixel data output rate is the same as the sampling clock rate in 8bit mode and 2x the data rate in 10-bit mode.
The clock frequency is set by a USB vendor command. A range of preset frequencies are listed below:
Command
30688e
328e90
306886
30b689
37cb8f
35d40b
306882
Clock
MHz
10
15
20
25
30
35
40
2.1MP
SVGA
1600 x 1200
800 x 600
4
6
8
10
12
14
15
15
24
35
40
48
56
60
Note: The factory can generate the command to achieve a targeted clock rate.
Sample Command:
There are multiple setting to achieve each frequency. Some might be better than others for a particular application.
Frame Rate Calculation
To calculate the frame rate for any clock rate the equation is:
(
clock rate(Hz)
)
=
# Frames Per Second (fps)
( # of clocks/row) * ( # of rows) + VSYNC
Clocks/Row (UXGA) = 1948
Clocks/Row (SVGA) = 974
Example:
What is the frame rate, at 25MHz clock rate for an image size of 1280 x 1024?
25 x 106
( 1280 + 164) * (1024) +
=
10 Frames Per Second (fps)
*** Subsampling frame rates are based on the resulting size of the subsampled image.
 Silicon Imaging , Inc. 2003
Page 8 of 25
Company Confidential
SI-2100 Register Programming
Image Size/Subsampling
The SI-2100 will default into the full 2.1Megapixel resolution image of 1600x1200. The image readout rate (frame
rate) will depend on the camera clock speed. The display update rate will depend on the PC CPU speed and color
processing selections.
Reg
12
(x20)
Image Size
1600 x1200 UXGA (Set to x20)
800 x 600 SVGA (Set to x60)
In order to increase these update rates, the camera supports subsampling mode. The entire sensor array is
readout and sub-sampled in horizontal and vertical directs to a ratio of 4:2, as illustrated in figure below, in order to
maintain correct bayer color representation. The 1600x1200 image will be reduced to an 800x600 representation
of the full field of view, with almost 4x the output frame rate. Set Register 12 to 0x60 to enable SVGA subsampling
mode.
 Silicon Imaging , Inc. 2003
Page 9 of 25
Company Confidential
Global Gain & Color Balance
Each row of pixels is sampled and the pixels shifted out one-by-one thru an analog amplifier with Global Gain. The amplifier
gain can either be manually programmed by the user (Reg 13 = 0) or controlled by the internal automatic gain control (AGC)
circuit (Reg 13 = xC5 or xC7). The AGC mode is enabled at the same time as Auto Expsoure (AEC) mode, in order to maintain
a target image brightness level.
The amplified signals are then color balanced. In this block, the Red and Blue channel gain is increased or decreased to match
Green channel luminance level. The adjustment range is +54 dB. Red/Blue Channel Balance can be done manually by the
user or by the internal automatic white balance (AWB) controller (Reg 13 = xC7).
13
(xC7)
00
(x00)
Auto/Manual
Exposure
GLOBAL
GAIN
0x00 = Manual Exposure & Gain
0xC5 = Auto Exposure Control / Auto Gain Control (AEC/AGC) or
0xC7 = Auto White Balance & Exposure (AWB/AEC/AGC)
Global Gain – 6 Bits ( Range: 1x to 8x)
Bit[7:6]: Unused
Bit[5:0]: Gain = (Bit[5]+1) x (Bit[4]+1) x ((1+Bit[3:0])/16))
Register [00]
000000
000001
000010
000011
000100
000101
000110
000111
001000
001001
001010
001011
001100
001101
001110
001111
010000
110000
111111
01
(x80)
02
(x80)
03
(x40)
Gain
1
1+1/16
1+2/16
1+3/16
1+4/16
1+5/16
1+6/16
1+7/16
1+8/16
1+9/16
1+10/16
1+11/16
1+12/16
1+13/16
1+14/16
1+15/16
2*(1+0/16)
4*(1+0/16)
4*(1+15/16)
dB
0
.375
.75
1.125
1.5
1.875
2.25
2.625
3
3.375
3.75
4.125
4.5
4.875
5.25
5.625
6
12
~18
BLUE
GAIN
[8 MSB]
Blue gain [9:0] - 10 Bits (Range: 1/5x to 5x)
BLUE[9:2] = Reg01[7:0] = 8MSB
BLUE[1:0] = Reg02[3:2] = 2LSB
RED
GAIN
[8 MSB]
Blue Gain Value=
If BLUE[9] = 1, then Blue gain = 1 + BLUE[8:0]/128
If BLUE[9] = 0, then Blue gain = 1/(1 + BLUE_B[8:0]/128),
where BLUE_B[8:0] is the bit reverse of BLUE[8:0].
Red gain [9:0] – 10 Bits (Range: 1/5x to 5x)
RED[9:2] = Reg02[7:0] = 8MSB
RED[1:0] = Reg02[1:0] = 2LSB
Blue Gain [2LSB]
Red Gain [2LSB]
 Silicon Imaging , Inc. 2003
Red Gain Value=
If RED[9] = 1, then Red gain = 1 + RED[8:0]/128
If RED[9] = 0, then Red gain = 1/(1 + RED_B[8:0]/128),
where RED_B[8:0] is the bit reverse of RED[8:0].
Bit[7:4]: AWB update threshold (0~15)
Bit[3:2]: BLUE Gain - lower 2 bits of Blue gain control
Bit[1:0]: RED Gain - lower 2 bits of Red gain control
Page 10 of 25
Company Confidential
Auto White Balance (AWB)
The SI-2100 continuously collects image statistics of the average output level data for the R/Gr/Gb/B channels and places them
in registers (x05, x06, x07, x08) for calculated image white balance. The values are calculated from 128 pixels per line (64
pixels per line in SVGA). The average of these 4 values is also calculated and placed in Reg 2F (Luminance Avg) to be used
for AEC control.
Set Reg 13 to 0xC7 to enable Auto White balance (AWB). The AWB circuit will calculate Red & Blue gain values and
automatically update registers x01,x02 and x03 to balance the colors in the image, until they are within a threshold range
(Reg3[7:4]). The number of steps and speed of adjustments are set in Reg4. The stability of the White Balance will vary on the
lighting conditions and the tolerance of the AWB threshold.
13
(xC7)
Auto/Manual
Exposure
03
(x40)
Auto White
Balance
Threshold
&
Red/Blue Gain
(2LSB)
Auto White
Balance
Speed
Bit[7:4]: AWB update threshold (0~15)
&
Bit[5:4]: AWB Update Speed Selection
00: Slow
10: Fast
01: Slowest 11: Fast
04
(x00)
Exposure
(3LSB)
0xC7 = Auto White Balance & Exposure (AWB/AEC/AGC)
Bit[3:2]: BLUE Gain - lower 2 bits of Blue gain control
Bit[1:0]: RED Gain - lower 2 bits of Red gain control
Bit[7:6]: AWB Step Selection
00: 1023 steps 10: 511 steps
01: 255 steps
11: 255 steps
Bit[3]: Reserved
Bit[2:0]: Exposure lower 3 bits – EXP[2:0]
05
(x00)
06
(x00)
07
(x00)
08
(x00)
2F
(x00)
BLUE
Average
B Channel Average
BAVG[7:0] – Calculated from all Blue pixels in the image
GREEN (b)
Average
Gb Channel Average
GbAVG[7:0]- Picked G pixels in the same line with B pixels.
GREEN (r)
Average
Gr Channel Average
GrAVG[7:0] - Picked G pixels in the same line with R pixels.
RED
Average
Average
Luminance
 Silicon Imaging , Inc. 2003
R Channel Average
RAVG[7:0] – Calculated from all Red pixels in the image
Luminance Average = Calculated from the B/Gb/Gr/R channel average:
AVG = (BAVG[7:0] + GbAVG[7:0] + GrAVG[7:0] +RAVG[7:0])/4)
Page 11 of 25
Company Confidential
Manual/ Auto Exposure Control (AEC)
The camera exposure time can be controlled manually or automatically. To enable manual control, set Reg13 to
x00. The Adjust the values in Reg10 and Reg4 to the desired levels. The total exposure is the sum of exposure
register and vertical blanking time of approximately 2msec.
Exposure Time = (Exposure Register * Line_Time) + Vertical_Blanking_Time (~2msec)
Line_Time = 1948 * Pixel_clock (UXGA)
Line_Time = 974 * Pixel_clock (SVGA)
To enable the Auto Exposure Control (AEC) and Auto Gain Control (AGC) function, set register 0x13 to xC5 or
xC7. The AEC/AGC will control the image brightness based on the values in Registers 0x24 (high threshold target
value) and 0x25 (low threshold target value.)
When the image luminance average (Yavg), found in Register 2F, is within the specified range of min/max values,
the AEC/AGC will not change the Exposure Time (Reg10 & 04) or Global Gains (Reg 0). When Yavg, is greater
than the value in register 0x24, the AEC will automatically decrease the image exposure and gains. When Yavg, is
less than the value in register 0x25, the AEC will increase the image exposure and gains. Accordingly, the value in
register 0x24 should be greater than the value in register 0x25. The difference between the min/max values
controls the image stability and brightness. The recommended spread between min and max is x10 to x20.
13
(xC7)
10
(x43)
04
(x00)
24
(x50)
25
(x40)
2F
(x00)
Auto/Manual
Exposure
Exposure
Time
[8 MSB]
Exposure
[3LSB]
Luminance
Max
AEH
Luminance
Min
AEL
Average
Luminance
0x00 = Manual
0xC5 = Auto Exposure Control / Auto Gain Control (AEC/AGC) or
0xC7 = Auto White Balance & Exposure (AWB/AEC/AGC)
Exposure [10:0] = t LINE x EXP[10:0]
EXP[10:3] = Reg10[7:0] = 8MBS
EXP [2:0] = Reg04[2:0] = 3LSB
Bit[7:3]: AWB Step Selection & Update Speed Selection
Bit[2:0]: Exposure lower 3 bits – EXP[2:0]
Luminance Signal High range for AEC/AGC operation
AEC/AGC value is decrease in auto modes when average luminance is greater than AEH [7:0]
Luminance Signal Low range for AEC/AGC operation
AEC/AGC values will increase in auto mode when average luminance is less than AEL [7:0]
Luminance Average
Calculated from the B/Gb/Gr/R channel average as follows:
AVG = (BAVG[7:0] + GbAVG[7:0] + GrAVG[7:0] +RAVG[7:0])/4)
Long Exposure (Extended Vertical Blanking)
In order to increase the maximum exposure time over 2048 line counts, the Vertical blanking period can be
extended using Registers 2D & 2E. A minimum blanking period of approx 7msec must be maintained for proper
camera operations. At 40MHz, Reg 2D must be a minimum of 0x90 (144 row times).
2D
(x90)
2E
(x00)
Vertical
Blanking LSB
Line periods added to Vertical Blanking Period. Each count will add 1 * Line_Time to the VSYNC
Vertical Blanking Period. A minimum of approx 7ms blanking is required.
Vertical
Blanking MSB
Line periods added to Vertical Blanking Period. Each count will add 256 lines.
 Silicon Imaging , Inc. 2003
Page 12 of 25
Company Confidential
Bayer Interpolation and Color Correction
White Balance and Color Correction are processing operations performed to ensure proper color fidelity in a
captured digital camera image. In digital cameras an array of light detectors with color filters over them is used to
detect and capture the image. This sensor does not detect light exactly as the human eye does, and so some
processing or correction of the detected image is necessary to ensure that the final image realistically represents
the colors of the original scene. In addition, each bayer pixel only represents a portion of the color spectrum and
must be interpolated to obtain an RGB value per pixel.
Bayer color filter array is a popular format for digital acquisition of color images. The pattern of the color filters is
shown below. Half of the total number of pixels are green (G), while a quarter of the total number is assigned to
both red (R) and blue (B).
G
B
G
B
R
G
R
G
G
B
G
B
R
G
R
G
To convert an image from this format to an RGB format, we need to interpolate the two missing color values in
each pixel. Several standard interpolation methods (nearest neighbor, linear, cubic, cubic spline) can be applied to
fill in the missing values in each pixel, resulting in a full size image with each pixel containing an R,G,B value.
The RGB interpolated data is then processed thru a color correction matrix which is used to eliminate the crosstalk
induced by the micro-lens and color filter process and compensates for lighting and temperature effects. The same
matrix can be used to increase overall color saturation.
The recommended default SI-2100 color matrix settings are in Table 4 below:
R’ =
G’ =
B’ =
 Silicon Imaging , Inc. 2003
R
1.268
<0.872>
<0.101>
G
<0.094>
1.821
*<0.126>
Page 13 of 25
B
<0.051>
<0.051>
1.227
Company Confidential
Color Saturation Matrix
The operation for saturation, can be applied at the same time as the color correction matrix. Unlike the color
correction matrix, the saturation matrix does not rotate the vectors in the color wheel:
[m00 m01 m02] [ R ]
[m10 m11 m12] * [G ]
[m20 m21 m22] [ B ]
m00 = 0.299 + 0.701*K
m01 = 0.587 * (1-K)
m02 = 0.114 * (1-K)
m10 = 0.299 * (1-K)
m11 = 0.587 + 0.413*K
m12 = 0.114 * (1-K)
m20 = 0.299 * (1-K)
m21 = 0.587 * (1-K)
m22 = 0.114 + 0.886*K
K is the saturation factor
K=1 means no change
K > 1 increases saturation
0<K<1 decreases saturation, K=0 produces B&W , K<0 inverts color
A sample table of matrix values are calculated and shown below:
Saturation
Saturation
Saturation
Saturation
R
R
R
R
G
B
1
1
0
0
1.7
1.4907
-0.4109
-0.0798
1.9
1.6309
-0.5283
-0.1026
2
1.701
-0.587
-0.114
G
G
G
R
G
B
0
1
0
-0.2093
1.2891
-0.0798
-0.2691
1.3717
-0.1026
-0.299
1.413
-0.114
B
B
B
R
G
B
0
0
1
-0.2093
-0.4109
1.6202
-0.2691
-0.5283
1.7974
-0.299
-0.587
1.886
Monochrome Saturation Matrix
A monochrome image can now be easily obtained from a color image by setting K=0
m00 = 0.299
m01 = 0.587
m02 = 0.114
 Silicon Imaging , Inc. 2003
m10 = 0.299
m11 = 0.587
m12 = 0.114
m20 = 0.299
m21 = 0.587
m22 = 0.114
Page 14 of 25
Company Confidential
SI-2100 REGISTER TABLE
00
00
01
(x80)
GLOBAL
GAIN
BLUE
GAIN
Global Gain – 6 Bits ( Range: 1x to 8x)
Bit[7:6]: Unused
Bit[5:0]: Gain = (Bit[5]+1) x (Bit[4]+1) x (1+Bit[3:0]/16)
Note: In Automatic Gain Controls (AGC) mode this register is automatically updated.
Set Register 13 = 0x00 for Manual Gain control.
Blue gain - 10 Bits (Range: 1/5x to 5x)
BLUE[9:2] = Reg01[7:0] = 8MSB
BLUE[1:0] = Reg02[3:2] = 2LSB
Blue Gain Value=
If BLUE[9] = 1, then Blue gain = 1 + BLUE[8:0]/128
If BLUE[9] = 0, then Blue gain = 1/(1 + BLUE_B[8:0]/128),
where BLUE_B[8:0] is the bit reverse of BLUE[8:0].
02
(x80)
RED
GAIN
[8 MSB]
Note: In Automatic Gain Controls (AGC) mode this register is automatically updated.
Set Register 13 = 0x00 for Manual Gain control.
Red gain – 10 Bits (Range: 1/5x to 5x)
RED[9:2] = Reg02[7:0] = 8MSB
RED[1:0] = Reg02[1:0] = 2LSB
Red Gain Value:
If RED[9] = 1, then Red gain = 1 + RED[8:0]/128
If RED[9] = 0, then Red gain = 1/(1 + RED_B[8:0]/128),
where RED_B[8:0] is the bit reverse of RED[8:0].
03
(x60)
04
(x00)
Auto White
Balance
Threshold
&
Red/Blue Gain
(2LSB)
Auto White
Balance
Speed
&
Exposure
(3LSB)
Note: In Automatic Gain Controls (AGC) mode this register is automatically updated.
Set Register 13 = 0x00 for Manual Gain control.
Bit[7:4]: AWB update threshold (0~15)
Bit[3:2]: BLUE Gain - lower 2 bits of Blue gain control
Bit[1:0]: RED Gain - lower 2 bits of Red gain control
Bit[7:6]: AWB Step Selection
00: 1023 steps 10: 511 steps
01: 255 steps
11: 255 steps
Bit[5:4]: AWB Update Speed Selection
00: Slow
10: Fast
01: Slowest 11: Fast
Bit[3]: Reserved
Bit[2:0]: Exposure lower 3 bits – EXP[2:0]
05
(x00)
06
(x00)
07
(x00)
08
(x00)
BLUE
Average
B Channel Average
BAVG[7:0] – Calculated from all Blue pixels in the image
GREEN (b)
Average
Gb Channel Average
GbAVG[7:0]- Picked G pixels in the same line with B pixels.
GREEN (r)
Average
Gr Channel Average
GrAVG[7:0] - Picked G pixels in the same line with R pixels.
RED
Average
 Silicon Imaging , Inc. 2003
R Channel Average
RAVG[7:0] – Calculated from all Red pixels in the image
Page 15 of 25
Company Confidential
10
(x43)
Exposure
Time
Exposure [10:0] = {Reg10[7:0] ; Reg04[2:0]}
EXP[10:3] = Reg10[7:0] = 8MBS
EXP [2:0] = Reg04[2:0] = 3LSB
Exposure Time = t LINE x EXP[10:0]
8 MSB
AEC (Automatic Exposure Control) automatically modifies this register
Note: Set Register 0x13 to 0 to disable the AEC.
12
(x20)
Image Size
UXGA 0x20
SVGA 0x60
13
(xC7)
Auto/Manual
Expsoure &
White Balance
Modes
0x00 = Manual
0xC5 = AEC
0xC7 = AWB/AEC
1600 x 1200 UXGA (Set to x20)
800 x 600 SVGA (Set to x60)
Bit[7]: AEC speed selection
0: Normal
1: Faster AEC correction
Bit[6]: AEC speed/step selection
0: Small steps, slow
1: Big steps, fast
Bit[5:3]: 0
Bit[2]: Exposure control
0: Manual
1: Auto
Bit[1]: AWB auto/manual control selection
0: Manual
1: Auto
Bit[0]: AGC auto/manual control selection
0: Manual
1: Auto
24
(xA0)
Target
Luminance
Max
AEC
Luminance Signal High range for AEC/AGC operation
AEC/AGC value is decrease in auto modes when average luminance is greater than AEH [7:0]
25
(x88)
Target
Luminance
Min
Luminance Signal Low range for AEC/AGC operation
AEC/AGC values will increase in auto mode when average luminance is less than AEL [7:0]
2F
(x00)
Average
Luminance
2D
(x90)
Add
Vertical
Blanking
LSB
Add
Vertical
Blanking
MSB
2E
(x00)
 Silicon Imaging , Inc. 2003
Luminance Average
Calculated from the B/Gb/Gr/R channel average as follows:
AVG = (BAVG[7:0] + GbAVG[7:0] + GrAVG[7:0] +RAVG[7:0])/4)
Line periods added to Vertical Blanking Period. Each count will add 1 * Line_Time to the VSYNC
Vertical Blanking Period. A minimum of approx 7ms blanking is required.
The Default VSYNC is 0x90 (144 row times). At a clock rate of 40MHz this is 7msec.
Line periods added to Vertical Blanking Period. Each count will add 256 lines.
Page 16 of 25
Company Confidential
White Balance and Color Correction
Application Note
1.0
Introduction
White Balance and Color Correction are processing operations performed to ensure proper color fidelity in a
captured digital camera image. In digital cameras an array of light detectors with color filters over them is used to
detect and capture the image. This sensor does not detect light exactly as the human eye does, and so some
processing or correction of the detected image is necessary to ensure that the final image realistically represents
the colors of the original scene.
Bayer color conversion and processing
This note describes conversions from Bayer format to RGB and between RGB and YUV (YCrCb) color spaces. We
also discuss two color processing operations (white balance and color correction) in the RGB domain, and derive
the corresponding operations in the YUV domain. Using derived operations in the YUV domain, one can perform
white balance and color correction directly in the YUV domain, without switching back to the RGB domain.
1. Conversion from Bayer format to RGB
Bayer color filter array is a popular format for digital acquisition of color images [1]. The pattern of the color filters is
shown below. Half of the total number of pixels are green (G), while a quarter of the total number is assigned to
both red (R) and blue (B).
G
B
G
B
R
G
R
G
G
B
G
B
R
G
R
G
To convert an image from this format to an RGB format, we need to interpolate the two missing color values in
each pixel. Several standard interpolation methods (nearest neighbor, linear, cubic, cubic spline, etc.) were
evaluated on this problem in [2]. The authors have measured interpolation accuracy as well as the speed of the
method and concluded that the best performance is achieved by a correlation-adjusted version of the linear
interpolation. The suggested method is presented here.
 Silicon Imaging , Inc. 2003
Page 17 of 25
Company Confidential
1.1 Interpolating red and blue components
G
R
G
B G
G R
B G
(a)
G
B
G
R
G
R
(b)
G
B
G
B
G
B
G B
R G
G B
(c)
R
G
R
G R
B G
G R
(d)
Figure 1: Four possible cases for interpolating R and B components
As suggested in [2], R and B values are interpolated linearly from the nearest neighbors of the same color. There
are four are possible cases, as shown in Figure 1. When interpolating the missing values of R and B on a green
pixel, as in Figure 1 (a) and (b), we take the average values of the two nearest neighbors of the same color. For
example, in Figure 1 (a), the value for the blue component on a shaded G pixel will be the average of the blue
pixels above and below the G pixel, while the value for the red component will be the average of the two red pixels
to the left and right of the G pixel.
Figure 1 (c) shows the case when the value of the blue component is to be interpolated for an R pixel. In such
case, we take the average of the four nearest blue pixels cornering the R pixel. Similarly, to determine the value of
the red component on a B pixel in Figure 2 (d) we take the average of the four nearest red pixels cornering the B
pixel.
1.2 Interpolating the green component
By [2], green component is adaptively interpolated from a pair of nearest neighbors. To illustrate the procedure,
consider two possible cases in Figure 2.
R4
G4
R1
G1
R
G3
R3
(a)
G2
R2
B4
G4
B1
G1
B
G3
B3
(b)
G2
B2
Figure 2: Two possible cases for interpolating G component
In Figure 2 (a), the value of the green component is to be interpolated on an R pixel. The value used for the G
component here is
(G1  G3 ) / 2,
if | R1  R3 || R2  R4 |


G( R)  
(G2  G4 ) / 2,
if | R1  R3 || R2  R4 |
(G  G  G  G ) / 4, if | R  R || R  R |
2
3
4
1
3
2
4
 1
In other words, we take into account the correlation in the red component to adapt the interpolation method. If the
difference between R1 and R3 is smaller than the difference between R 2 and R4, indicating that the correlation is
stronger in the vertical direction, we use the average of the vertical neighbors G 1 and G3 to interpolate the required
value. If the horizontal correlation is larger, we use horizontal neighbors. If neither direction dominates the
correlation, we use all four neighbors.
Similarly, for Figure 2 (b) we will have
 Silicon Imaging , Inc. 2003
Page 18 of 25
Company Confidential
(G1  G3 ) / 2,
if | B1  B3 || B2  B4 |


G( B)  
(G2  G4 ) / 2,
if | B1  B3 || B2  B4 |
(G  G  G  G ) / 4, if | B  B || B  B |
2
3
4
1
3
2
4
 1
To conclude this section, note that if the speed of execution is the issue, one can safely use simple linear
interpolation of the green component from the four nearest neighbors, without any adaptation
G  (G1  G2  G3  G4 ) / 4
According to [2], this method of interpolation executes twice as fast as the adaptive method, and achieves only
slightly worse performance on real images, while it is actually better than the adaptive method when applied to
synthetic images.
2. Conversion between RGB and YUV
We give two commonly used forms of equations for conversion between RGB and YUV formats. The first one is
recommended by CCIR [3]
Y  0.257 R  0.504G  0.098B  16
U  0.439 R  0.368G  0.071B  128
(2.1)
V  0.148R  0.291G  0.439 B  128
The second form is used by Intel in their image processing library [4], and may be more suitable for
implementation:
Y  9798R  19235G  3736 B  / 215
(2.2)
15
U  21208R  16941G  3277 B  / 2
 128
V   4784 R  9437G  4221B  / 215  128
In either case, resulting values of Y, U and V should be clipped to fit the appropriate range for the YUV format (e.g.
[0,255] for a 24-bit YUV format). The inverse conversion may be accomplished by:
R  1.164(Y  16)  2.018(V  128)
G  1.164(Y  16)  0.813(U  128)  0.391(V  128)
(2.3)
B  1.164(Y  16)  1.596(U  128)
3. White balance operation in RGB and YUV domains
The white balance operation is defined as a gain correction for red, green and blue components by gain factors AR,
AG and AB, respectively, i.e.
Rwb  AR R
Gwb  AG G
Bwb  AB B
(3.1)
The new (white-balanced) values for red, green and blue are Rwb, Gwb and Bwb. To derive the equivalent form of
this operation in the YUV domain, we proceed as follows. First, write equation (2.1) as
 Silicon Imaging , Inc. 2003
Page 19 of 25
Company Confidential
y  Cx  v (3.2)
where
x  ( R, G, B)T is the vector in the RGB space, y  (Y , U ,V )T is the corresponding vector in the YUV
space, v
written as
 (16,128,128)T , and C is the appropriate matrix of conversion coefficients. Similarly, (3.1) can be
x wb  Ax
(3.3)
x wb  ( Rwb , Gwb , Bwb )T is the vector in the RGB space modified by white balance operation (2.4), and
A  diag ( AR , AG , AB ) . We want to determine what is the corresponding vector y wb in the YUV domain,
without having to revert back to the RGB domain. Vector y wb is found by substituting x wb for x in (3.2)
y wb  Cx wb  v  CAx  v .
where
Let
D  CA , so that y wb  v  Dx . Then x  D 1 y wb  v . Substitute this expression for x back into (3.2)
to obtain
y  CD 1 y wb  v   v (3.4)
This equation provides the connection between y and
y wb without involving x or x wb (i.e. without going back to
the RGB domain). Manipulating (3.4) and using the fact that for nonsingular matrices
get that white balance operation in the YUV domain is
CD 1 1  DC1 [5], we
y wb  DC1 y  v   v  CAC 1 y  v   v (3.5)
Expressing components of
Y
wb
 ( 0.299AR  0.587AG  0.114AB )(Y  16)  ( 0.410AR  0.410AG )(U  128)  ( 0.197AG  0.198AB )(V  128)  16
wb
 ( 0.511AR  0.428AG  0.008AB )(Y  16)  ( 0.701AR  0.299AG )(U  128)  ( 0.144AG  0.143AB )(V  128)  128
wb
 ( 0.172AR  0.339AG  0.511AB )(Y  16)  ( 0.236AR  0.237AG )(U  128)  ( 0.114AG  0.886AB )(V  128)  128
U
V
y wb from (3.5) we get
Terms with leading coefficient less than 103 have been dropped.
References
[1] B. E. Bayer, Color imaging array, US Patent No. 3971065.
[2] T. Sakamoto, C. Nakanishi and T. Hase, “Software pixel interpolation for digital still cameras suitable for a 32bit MCU,” IEEE Trans. Consumer Electronics, vol. 44, no. 4, November 1998.
{3} http://www.northpoleengineering.com/rgb2yuv.htm
 Silicon Imaging , Inc. 2003
Page 20 of 25
Company Confidential
Binary to Hex (ASCII) Table
Binary
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
 Silicon Imaging , Inc. 2003
Hex in ASCII
0
1
2
3
4
5
6
7
8
9
a
b
c
d
e
f
Page 21 of 25
Company Confidential
SI2100 Senor Cover Glass Dimensions
FRONT VIEW
 Silicon Imaging , Inc. 2003
Page 22 of 25
Company Confidential
SI-2100RGB
SAMPLE COLOR IMAGE
 Silicon Imaging , Inc. 2003
Page 23 of 25
Company Confidential
SI2100-RGB Cover Glass Filter Response (IRC-30)
 Silicon Imaging , Inc. 2003
Page 24 of 25
Company Confidential
Contact Information
Silicon Imaging, Inc.
www.siliconimaging.com
sales@siliconimaging.com
Ordering Information
SI-2100RGB-U
2.0 Mpixel Bayer Color USB2.0 MegaCamera
Legal Disclaimer
Silicon Imaging reserves the right to make changes to its products or to discontinue any product or service without notice, and advises
customers to obtain the latest version of relevant information to verify, before placing orders, that information being relied on is current and
complete. No license, express or implied to any intellectual property rights is granted by this document.
Specific testing of all parameters of each device is not necessarily performed, except those mandated by government requirements.
CERTAIN APPLICATIONS USING SEMICONDUCTOR PRODUCTS MAY INVOLVE POTENTIAL RISKS OF DEATH, PERSONAL INJURY,
OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE ("CRITICAL APPLICATIONS"). SILICON IMAGING PRODUCTS ARE NOT
DESIGNED, AUTHORIZED, OR WARRANTED TO BE SUITABLE FOR USE IN LIFE-SUPPORT DEVICES OR SYSTEMS OR OTHER
CRITICAL APPLICATIONS. INCLUSION OF SILICON IMAGING PRODUCTS IN SUCH APPLICATIONS IS UNDERSTOOD TO BE FULLY AT
THE CUSTOMER'S RISK.
The Product described in this datasheet may contain design defects or errors known as errata which may cause the product to deviate from
published specifications. Current characterized errata are available upon request.
Copyright: Silicon Imaging, Inc., 2003
113003-rev 1.0
 Silicon Imaging , Inc. 2003
Page 25 of 25
Company Confidential
Download