Snap & Live Mode Capture

Document Sample
Snap & Live Mode Capture Powered By Docstoc
					                   Silicon Imaging
               SI-1300 MegaCamera
 1.3 Million Pixel Progressive Scan Digital Camera




                                         Revision 1.2
                                       August 3, 2004
                                  1.3 Million Pixels
                                  1280 x 1024 Image Sensor
                                  5.2 um Square Pixel
                                  ½ Optical format
                                  Rolling Shutter
                                  ½ & ¼ Image Subsampling
                                  10~40MHz Mhz Clock rates
                                  10 Bit Digital Sampling
                                  Auto Black Level Correction
                                  64dB Dynamic Range
                                  USB2.0 High-Speed Interface
                                **** Company Confidential ****



 Silicon Imaging , Inc. 2004              Page 1 of 55          Company Confidential
SI-1300-M & RGB MegaCamera™
1.3 Megapixel (1280 x 1024), 10-Bit Low-Noise, 40MHz
USB 2.0 High-Speed 480Mb/sec Digital Camera

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.

1280 x 1024 Megapixel - Ultra Resolution
The SI-1300 is an all-digital CMOS camera that delivers 1.3 Million pixels of
resolution and is capable of running at 30 frame/sec at 1024 x 1024
resolution and 25fps at its full 1280x1024 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. For handheld instrumentation
designs the ‘R’ version PCB is small enough to fit into a 27mm diameter.

10-Bits Low-Noise (<20e-) – Sub-Pixel Accuracy
The SI-1300 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. The results are impressive
with low-noise and low-dark currents to allow increases in gain and exposure
time for improved signal noise. Image transfer can be switched from 8 to
16bit mode, to get full 10bit data. A programmable 10~40MHz clock allows
for trade-off in bit-depth and speed versus exposure time and lower noise.

75 FPS VGA Subsampling - Fast Preview
Ideal for high speed preview and focusing, the SI-1300 is capable of
generating imagery at over 100 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 640x480 accurately represents the full size
1280x1024 image.

Automatic Black Level Correction – IR Sensitivity                                   FEATURES
The SI-1300 has automatic black level calibration, which measures the
average value of 256 pixels from two dark rows of the imager for each of the         ·   1280 x 1024 Resolution (1.3 Million Pixels)
four colors. The pixels are averaged as if they were light sensitive and
passed through the appropriate color gain. This average is then digitally            ·   1/2” Imaging Format, 5.2um Square Pixel
filtered over many frames and compared to minimum and maximum
                                                                                     ·   Rolling Shutter, Progressive scan
acceptable thresholds for automatic correction.
                                                                                     ·   120fps Windowing at 320 x 240 QVGA
USB2.0 Bus-Powered – 40MB/sec Transfers
                                                                                     ·   10 Bits per Pixel, 35MHz Sampling (Nominal)
For low-cost and portable connectivity, with data transfer rates up to
40MB/sec, the SI-1300U provide convenient capture using the High-Speed               ·   10 ~ 45MHz Programmable Clock
480Mb/sec USB 2.0 interface. It is a bus-powered unit, consuming less than
500mA at 5VDC and will operate without any external power supply. The                ·   IR-Sensitivity & Low-dark Currents (<20e-)
precision-machined C-mount housing includes an integrated tethered USB
cable and optional 3-pin trigger/strobe connection. For OEM board level              ·   Programmable Gain, Exposure & Clocks
configurations, two General Purpose Outputs are accessible; Pull-Up and
pull-down driven transistors to be used to control light sources and switches.       ·   Auto Black Level Calibration
                                                                                     ·   Monochrome & Color Bayer RGB Model
Microsoft-XP™ Live Mode Kernel Driver - Fast captures
For applications which require a combination of high-resolution and                  ·   Custom PCB Version
streaming high-frame rate video images, Silicon Imaging has developed a
                                                                                     ·   USB2.0 High-Speed, 480Mb/sec Interface
custom driver which can request and capture double buffered images at the
driver level. This method enables immediate request to camera for next               ·   C-Mount Precision Machined Housing
image without user level software intervention. The double-buffers allow one
image to processed by the host PC, while another image is being readout              ·   Image Capture & Color Processing SDK
from the camera and filled into the user allocated memory space.




         Silicon Imaging , Inc. 2004                                Page 2 of 55                             Company Confidential
                          SI-1300 USB2.0 MegaCamera Specifications

Sensor:                                                                USB2.0 High-Speed Interface & Control:
 Optical Imaging Format      1/2” (6.83mm x 5.45mm)                     USB Speed                480Mb/sec (High-Speed)
 Active Pixels               1,280H x 1,024V                            Serial Communication     Endpoint 0, Vendor Protocol
 Pixel Size (pitch)          5.2 µm x 5.2 µm                            Data Interface           Endpoint 2, 2K FIFO
 Pixel Type                  CMOS                                       Programmable Modes       Exposure, Gain, Windowing, Clock
 Aspect Ratio                1:1                                                                 rates, Auto black, mirroring.
 Spectral Response           350 ~ 1000 nm                              Region-of–Interest       Programmable Horiz & Vertical
 Peak QE                     56% Monochrome @ 570nm                     Gains (R,G,B,G & Global) Individual R,G1,B, G2 Gains
                             0.3 lux nominal ( SNR =1, f# = 2.8,                                 Range: 15X, MIN step size 0.125
 Minimum Illumination:
                             exposure = 100ms, daylight)                Setting Timing           Next top of Frame
 Responsivity                2.1 V/lux-sec                              Ext Clock Sync           Clock in or Clock Out (-X Option)
 Dark Current @ 25°C         20 e-/sec                                  External Triggers        TTL Trigger-In / Strobe-Out
 Temporal Noise              10 e-                                                               w/3-Pin connection (option)
                                       -
 Saturation Charge           40,000 e
 Dynamic range                68.2 dB
 Windowing (ROI)             Horizontal & Vertical speed increase     Power
 Sub-sampling                Full, 1/2, 1/4, 1/8                        Input Voltage              +5 VDC +/- 10%
 Gain MAX                    15X, min step size 0.125                   Power                      2.5 Watts
 Readout Method              Progressive Scan                           Trigger Connection (opt)   Tajimi RO3-PB3M 3Pin (optional)
 Black Level                 Auto Black Level Calibration
 Shutter                     Rolling Shutter and Single Frame
 Shutter Speed               Variable, 1 to 16383 row times
 Horizontal Blanking         244 Clocks/line                          Mechanical
 Minimum Row Time            548 Clocks (304+ 244 Blanking)             Lens Mount                 C-Mount, 7mm Back focus Adj.
 Vertical Blanking           26 Rows                                    Enclosure Size             45mm W x 52mm H x 50mm L
 Row/Frame Time              1524 clocks/row x 1050/rows = 30fps        Weight                     12 oz.
                                                                        Camera Mount               ¼” x 20 standard tripod mount
                                                                        Cable Connector            Mini-B USB
A/D Conversion & Sampling Clock Synthesizer
 A/D Conversion              Nominal 35Mhz (24fps @ 1.0MP)
 Vertical Resolution         10 Bit                                   Spectral Response Curve (Monochrome)
 Pixel Clock Frequency       10 ~ 40 Mhz Programmable


Digital Video Output
Readout Format                8-bit or 16bit (10-bit data)
Readout Rate                  10 ~ 40Mhz ( 8bit format
                              10~ 25Mhz (16-bit format)
Max Transfer Rate             ~ 40MB/sec(ICH4 or higher)
Frame Rate                          40MHz                 20MHz
            1280 x 1024               25                    12
            1024 x 1024               30                    15
             1280 x 720               35                    17
             1024 x 768               40                    20
              640 x 480               85                    42
              320 x 240              220                   110

Row Time                      clocks/row / Clock =Row_Time
                              1524 / 40MHz = 38.1usec/row
Exposure Time                 N-Row Times


                                             SI-1300 Ordering Information
SI-1300U -M or -RGB              1.3 Megapixel USB2.0 Camera, M=Monochrome, RGB= Bayer Color
-PCB or -R                       PCB (33x40mm) or ‘R’ Round (27mm) Version of Camera. No housing included.
-T                               External Trigger & strobe with 3-Pin Connection and Trigger/Strobe Breakout Cable
-X                               External Clock-In & Clock out camera. Must be ordered as a Master-Slave configuration
CBL-3PT                          Cable, 3Pin Tajimi to TTL Trigger-In & Strobe Out




       Silicon Imaging , Inc. 2004                          Page 3 of 55                                 Company Confidential
                                   SI-1300 Camera Architecture Overview
The MegaCamera SI-1300 consists of 6 major component sections, which are built on two circuit boards.


                                     1.) 1.3 Megapixel Sensor
                                     2.) Digital Clock Synthesizer
                                     3.) Digital Control Logic
                                     4.) Microprocessor
                                     5.) USB 2.0 High-Speed Interface
                                     6.) Power Regulation
                                     7.) Trigger & Strobe Controls




                                       Register                        uP           Trigger
                                     Programming                     Control       Controller


                                                     DATA (10)




                                                                                                Strobe Out
                                                                     Digital



                                                                                   Trigger In
                                                      FVAL
                                     1280 x 1024      LVAL           Logic
                                       Sensor        CLOCK
                                          &
                                        A/D
                                      Converter                        8/10        5VDC
                                                                   Digital Data    Power
                                                                                   Supply

                                     PLL & Timing
                                      Generator                          USB 2.0



                                              Camera Block Diagram


1.)      1.3 Megapixel CMOS Image Sensor (1280 x 1024)
The MegaCamera SI-1300 utilizes a proprietary 1.3 Million pixel high-speed CMOS image sensor. Each pixel is
5.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-1300 provides
inherent anti-blooming protection in each pixel, so that there is no blooming.




    Silicon Imaging , Inc. 2004                    Page 4 of 55                                             Company Confidential
The array has 1280 pixels on a line and 1024 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 read-
out scheme (aka. Rolling Shutter Method)




Analog Gain Amplifier & Offset
The imager signal path consists of two stages, a programmable gain stage and a programmable analog offset
stage. The gain settings can be independently adjusted for the colors Green1, Blue, Red, and Green2 and are
programmed through registers. A total programmable gain of 15 is available. The programmable analog offset
stage corrects for analog offset that might be present in the analog signal. The analog offset settings can be
independently adjusted for each color (R/G1/G2/B).


Automatic Black Level Compensation
The automatic black level calibration measures the average value of 256 pixels from two dark rows of the imager
for each of the four colors. The pixels are averaged as if they were light-sensitive and passed through the
appropriate color gain. This average is then digitally filtered over many frames. For each color, the new filtered
average is compared to minimum and a maximum acceptable level. If the average is lower than the minimum
acceptable level, the offset correction voltage for that color is increased. If it is above the maximum level, the level
is decreased. The upper threshold is automatically adjusted upwards whenever an upward shift in the black level
from below the minimum results in a new black level above the maximum. This prevents black level oscillation
from below the minimum to above the maximum. The lower threshold is increased with the maximum gain setting
(out of all four colors), according to Register settings. This prevents clipping of the black level. After changes to
the sensor configuration, large shifts in the black level calibration can result. To quickly adapt to this shift, a rapid
sweep of the black level during the dark-row readout is performed on the first frame after certain changes to the
sensor registers.


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. This 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).




    Silicon Imaging , Inc. 2004                          Page 5 of 55                                  Company Confidential
3.)      Digital Clock Synthesizer
A wide range a master clock frequencies (eg. 7 to 40MHz) can by precisely generated using the Digital Clock
Synthesizer. The frequency of the clock synthesizer can be set by API command. A table with associated clock
frequency is found in the serial programming section of the manual. Due to minimum frequency restriction on the
digital transmission link, the pixel clock frequency cannot be higher than 40Mhz in 8-bit mode or 20~25MHz in
16bit mode (depending on image size).


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 MemoryUSB2.0 Interface & triggers. The Microprocessor receives
commands thru the USB 2.0 port and issues commands to the other devices. It also can store preset values for
camera setting, deviant pixel correction lists or other user data which can be stored and recalled from internal
EEPROM.


5.)      USB2.0 Interface & Power
The UBS2.0 interface connects the camera to the PC with a single 4-wire cable. The high-speed port provides
sustained data rates of over 40MB/sec and also provides +5VDC to the camera for bus-powered operation. The
interface also provides bi-directional serial communication for camera setup and control, triggering, strobing and
other I/O signaling.


6.) Triggers & GPIO

Several digital I/O and pull-up/pull-down transistors signals are available for control via the processor on PCB
header points, for custom OEM applications. The –T option will provide a 3-pin connector for Trigger in and strobe
out operation. A trigger or trigger-strobe cable should be ordered separately.




                                   3-PIN TRIGGER-In/ STROBE-OUT WIRING




    Silicon Imaging , Inc. 2004                   Page 6 of 55                              Company Confidential
                                                 Installation
Download and install the current software from the Zip compressed file by double-clicking on the MegaXVInstall:




The Wizard will take you thru the steps to completion.




Once the MegaXV software and USB drivers (ezusb.sys & ezusbsi.inf) or extracted, you are ready to plug-in the
camera.




      Silicon Imaging , Inc. 2004                   Page 7 of 55                            Company Confidential
USB Drivers & Device Manager
Plug in the Camera and follow the Wizard:




     Silicon Imaging , Inc. 2004           Page 8 of 55   Company Confidential
A warning message will appear:




Press Continue Anyway.




Select ‘Finish’. The Registry has now been updated and the camera can now be accessed by the MegaXV
application.




     Silicon Imaging , Inc. 2004                Page 9 of 55                         Company Confidential
You can confirm the camera and USB 2.0 drivers are correctly installed by viewing the Device Manager:




You will see an entry for Silicon Imaging USB2.0 Mega Camera:




     Silicon Imaging , Inc. 2004                   Page 10 of 55                           Company Confidential
The Enhanced Host Controller entry is the USB2.0 hardware. This will most likely be an Intel 82801DB (ICH4),
ICH5, ICH6 or NEC PCI hardware device. The driver will either be Microsoft or Adaptec. In Windows XP, Microsoft
provides the USB2.0 drivers for both Intel and NEC hardware controllers.




     Silicon Imaging , Inc. 2004                  Page 11 of 55                           Company Confidential
                                                   Run MegaXV

Double-Click the MegaXV icon from the Silicon Imaging software directory:




When MegaXV first starts, the screen looks blank. Cameras or Images can be opened into the MegaXV software.
Initially, no cameras are available. By clicking on the + buttun, the first of any connected cameras should be
added. Press + again will add additional cameras into the MegaXV desktop.




Once a camera is added, it will be visible as a label [SI1820C] in the active window: Select between active cameras
from the top tab to control their views for capture and display.




Press the Play button           to start a LIVE display from the bottom capture bar:




The camera or image can be captured and scaled to fit in the window (Zoom %), processed with monochrome (B/W
checker) or Bayer color (color Checker)).




To assess the maximum data transfer rate, the display should be turned off using the no display button (Black box).




      Silicon Imaging , Inc. 2004                       Page 12 of 55                         Company Confidential
                                          MegaXV Menus




The MegaXV Application is controlled from 2 areas the Control Bar (Bottom) and the Config (Right). These
windows can be floated or closed once the selections are made, to increase the window space available for
image display.




    Silicon Imaging , Inc. 2004                  Page 13 of 55                            Company Confidential
                                     CAPTURE CONTROLS TOOLBAR
The capture controls are at the bottom of the screen. The camera icon snaps a single image. The triangle starts
continuous capture and the square stops it. When in continuous mode, the ‘Frame captured’ should keep
increasing. The Frame rate shows a long-term average. If adjustments are made, it is necessary to stop and start
the display to see an immediate effect on the frame rate.




ARM TRIGGER (-T trigger Option)

Select this mode to capture images using an external trigger. This can be used with Single-Frame Snap or Live
Snap. If either capture is started the camera is put in a waiting state until a trigger is detected. Upon trigger, an
image is captured and transferred into memory for display. In continuous snap mode, the capture is then rearmed
awaiting another trigger.


DOUBLE BUFFER SNAP

This modes uses 2 frame memory buffers and ping-pongs between buffers for each snap. Under certain capture
conditions and camera model, this mode may provide a slightly higher capture rate.




                                             CONFIG TOOLBAR

There are four tabs on the Config Toolbar (right panel): Color, Camera, Info & Log.




  The camera tab will display the current model camera being controlled such as SI1300, SI-3300, SI1280 or
  SI3170.




      Silicon Imaging , Inc. 2004                    Page 14 of 55                               Company Confidential
Camera Tab

Size
Sets the image capture window size. The default ROI Origin is
usally 0,0 (in the top, left). However the X_Origin & Y_Origin
can be moved using sliders.

The Image Size defaults:
                 1280X1024
                 1024X1024
                 1024X768
                 640 X 480
                 320X240
                 CUSTOM

The ‘Custom’ option can be used to set an arbitrary window size.


Bit Depth – 8 or 12 bit.
12 bit operation requires twice the USB bandwidth and will have
half the frame rate. Be sure to set the Maximum clock speed to
20MHz (or 25MHz for sizes below 1K are possible)


Gain & Offset – sets the camera analog RGGB or Global gains.
The Global gain will overwirte the RGGB gains when selected,
loading the same value into all 4 gain registers. The analog
gain should be set as low as possible for minimizing fixed
pattern noise.


Clock and Exposure – The clock rate can be set within a range
of 7 to 40MHz, dependent on the camera and host controller.


Black Reference - Used to capture a black reference frame
and subsequently subtract each pixel from the snapped blacked image.




    Silicon Imaging , Inc. 2004                  Page 15 of 55        Company Confidential
                                                     Color Tab
The Color tab provides a variety of digital controls for adjusting the
image quality.

Digital Gain –
With a color camera, the relative gain values for each color
channel can be adjusted. A global gain can also be used to
enhance the image.

Offset
A black level offset can be added to the image to improve the
black contrast.


Saturation
A saturation matrix is applied to the color image. The double
arrow displays the matrix.




White Balance
A preset (selected below) color setting or automatic white balance
can be selected. For Automatic white balance, the double arrow
provides a number of algorithm options (Gray Worl or White
Patch). During AWB operation, the current RGB values can be set
to hold. Selecting Preset will use the RGB gains in the CFG Preset file.

Bayer Phase
For color cameras, the sensor has a red, blue, green matrix of color filters in a pattern called a Bayer Color Filter.
Depending on the starting color for the window, the Phase value may need to be adjusted. This is done by viewing
a red or blue object and selecting the phase that provides the correct color.

Bayer Interpolation Method
The ‘Basic’ method is the fastest method for filling in the RGB values of a bayer pixel, using the nearest neighbor
missing color. When color edge quality is required, the interpolation method can be set to ‘Advanced’ at the
expense of frame rate.

Deviant Pixel Correction – Checking this box will provide automatic sensing and correcting for any pixels that are
not responding correctly. This is a processing intensive algorithm and will reduce the maximum display rate of
MegaXV. The DPC NUMBER of pixels to be corrected is set in the CFG file.


Presets – Complete color transformation matrices correcting for differing lighting temperatures and AWB/Preset
values, Interp Method and DPC Count can be selected, either from a list or a new file using >> button.




      Silicon Imaging , Inc. 2004                      Page 16 of 55                             Company Confidential
                                      Info Tab - USB Vendor Request

This provides model, firmware revision and camera serial number
information. Please have the model and firmware version available
when calling or emailing problem reports.

The Vendor Request Dialog is only to be used by developers
testing low-level USB command transfers to the camera. It should
not need to be used during the normal operation of the camera.

The basic Vendor Request provides the following fields:

Vendor Request:     8 bits    Command (eg. Load Camera Register)
Value:              16 bits   Value to load into Register
Index:              16 bits   Camera Register
Length:             16 bits
Direction:          1 bit      (IN =1 or OUT=0)

A non-zero length vendor request implies an endpoint 0 (EP0) data
transfer, which is either IN or OUT. A "Hex Bytes" input field is
provided in the control panel window and holds the data for OUT
transfers.

The following is the Silicon Imaging API function used to
Downloads or uploads arbitrary Endpoint-0 control data to the
camera registers.


int TransferCamControlData(int iCamNumber, int
iVendorRequestCode, int iIndex, int iValue, int iDirection, int
iBufferSize, unsigned char* buffer)

A non-zero Length Vendor Request implies an EndPoint 0 (EP0)
data transfer, which is either IN or OUT.




      Silicon Imaging , Inc. 2004                      Page 17 of 55   Company Confidential
                                             Firmware Upload
This operation should be done carefully, as it is possible to render the camera non-functional and not field
repairable. Be sure the camera is in a stopped mode before continuing.




After selecting the Upload Firmware menu option, you will select the newer version of firmware:




Be sure that the firmware matches the camera type. Also, the firmware is distributed as a zip file and must be
unzipped before installing. After selecting the firmware, several minutes will pass. Do not do anything. Eventually,
this window will display:




Each version of firmware is distributed with a checksum value. This is a unique value for every firmware version.
Enter the value, click on OK and DO NOT TOUCH THE COMPUTER UNTIL THE PROCESS IS COMPLETE. This
can take 30 seconds to a minute.




      Silicon Imaging , Inc. 2004                    Page 18 of 55                               Company Confidential
                                           Image Save & Load
The operational screen should look like this:




The file menu provides a method for opening image files, saving binary files and bitmaps.




      Silicon Imaging , Inc. 2004                   Page 19 of 55                          Company Confidential
                                BLACK REFERENCE CORRECTION
In order to correct for background non-uniformity and dark current accumulation, a full frame image subtraction can
be performed on a pixel for pixel basis:




Cover your lens and adjust Black Offset and Column offset to insure Black is in the digitizing range:




      Silicon Imaging , Inc. 2004                    Page 20 of 55                              Company Confidential
From the Camera Tab (eg. SI1300), press the GRAB button and check the apply radio box.




The image should now appear black:




     Silicon Imaging , Inc. 2004                 Page 21 of 55                          Company Confidential
Uncover the lens and the picture will have a uniform background:




Go to the Color Tab and Select the correct lighting color correction Presets Option (Tungsten, Fluorescent,
Sunlight, etc). Then, adjust Digital Gains & Offset for best contrast and Advanced Interpolation for best rendering:




      Silicon Imaging , Inc. 2004                   Page 22 of 55                             Company Confidential
                                   Introduction to USB Communication

Vendor Requests – Endpoint-0 Communication
All camera controls and programming are done at the lowest level USB communication using Vendor Requests
(VR). The VR’s codes have been assigned by Silicon Imaging, “the vendor” and their functions are defined in the
following section.

The Vendor Request can be used to change all camera settings or the high-level API can be used to perform the
same functions. The INFO-tab of MegaXV, provides a convenient method for sending these commands and
seeing the results.

The basic Vendor Request provides the following fields:

Vendor Code:      8 bits
Value:            16 bits
Index:            16 bits
Length:           16 bits
Direction:        1 bit, (IN (1) or OUT (0))

A non-zero length vendor request implies an endpoint 0 (EP0) data transfer, which is either IN or OUT. A "Hex
Bytes" input field is provided in the control panel window and holds the data for OUT transfers.



TransferCamControlData( )

The following is the Silicon Imaging API function used to send any vendor request command:

int TransferCamControlData (int iCamNumber, int iVendorRequestCode, int iIndex, int iValue, int iDirection, int
iBufferSize, unsigned char* buffer) ;


Description:

Downloads or uploads arbitrary Endpoint-0 control data to the camera registers.


Arguments:

iCamNumber –          number of camera device
iVendorRequestCode - vendor request code
iIndex –              Camera register or value (16 bits)
iValue –              data value per command (16 bits)
iDirection –          1 (IN) - upload from camera to host and transmit commands with return strings
0 (OUT) - download from host to camera
iBufferSize –         number of bytes to transfer to/from register specified by the iIndex value
*buffer –              pointer to buffer containing control information (typ recived from the camera for 1=IN)


A non-zero Length Vendor Request implies an EndPoint 0 (EP0) data transfer, which is either IN or OUT.




    Silicon Imaging , Inc. 2004                   Page 23 of 55                             Company Confidential
                                         SI-1300 USB VENDOR CODES

 VR       Function                       Value       Index      DIR    Buffer   Description

          Write Register                  xVVVV      xRRRR        1       0        0x00                 Chip ID
 0x94
                                                                                   0x01                Row Start
                                           Value     Register                      0x02              Column Start
                                             To        To                          0x03             Window Height
                                           Write      Write
                                            Into                                   0x04             Window Width
                                          register                                 0x05           Horizontal Blanking
                                                                                   0x06            Vertical Blanking
                                                                                   0x09                Exposure
                                                                                   0x0C             Shutter Delay
                                                                                   0x1E              Subsampling
                                                                                   0x20             Subsampling 2
                                                                                   0x2B              Green1 Gain
                                                                                   0x2C                Blue Gain
                                                                                   0x2D                Red Gain
                                                                                   0x2E              Green2 Gain
                                                                                   0x35              Global Gain

                                                      xRR
 0x94     Read Register                      0
                                                     Register
                                                                  1       2     Read Register (16-bit) response
                                             0          0         1      16     Issue an IN transfer of Length 16 to Read
0xE1      Read Firmware Version                                                 Firmware Version. The Value and Index
                                                                                fields are ignored. The returned string will
                                                                                contain ASCII characters, and the last byte
                                                                                will be zero.
0xE7      Read Serial Number                 0          0         1      16     To read Serial Number String from the
                                                                                Camera, issue an IN transfer of Length 16
                                                                                bytes. The Value and Index fields are
                                                                                ignored. The returned string will contain
                                                                                ASCII characters.
0xE4      Write Flash memory (OUT)           0       0x0000       0      32     An OUT transfer of 16 is used for storage of
                                                       to                       32 words of 14bit values. The Index field is
                                                     0x00FF                     used to address 256 blocks(0xFF) of
                                                                                memory. The first byte and every odd byte
                                                                                contain only 6 usable bits. The Value field is
                                                                                ignored. This command is used in firmware
                                                                                upgrades, but the data storage can be used
                                                                                for other function
0xE4      Read Flash memory                  0       0x0000       1      32     An IN transfer of 32 is used to read 16
          (OUT)                                         -                       words of 14bit values. The Index field is
          Note: This memory space                    0x00FF                     used to address 256 blocks (0xFF) of
          is used in firmware                                                   memory. The first byte and every odd byte
          upgrades and will overwrite                                           contain only 6 usable bits. The Value field is
          any user data stored in this                                          ignored. This command is read arbitrary
          memory.                                                               data stored by the Write Flash command.
0xE4      Upgrade Firmware (IN)           CODE          0         1       4     An IN request of Length 4 will expect a
                                                                                firmware upgrade code (from factory) in the
          WARNING! Please wait 30                                               Value field (length 16 bits – 4 hex). Index
          seconds before unplugging                                             field ignored. If the CODE does not match,
          the camera to allow the                                               the returned 4 bytes will contain the ASCII
          upgrade to complete.                                                  "FAIL". If the code does match, the 4 bytes
                                                                                of data returned will be "DONE". After the
                                                                                firmware update is done, the USB Camera
                                                                                should be reboot (unplug and replug). The
                                                                                new firmware will then be active.
0xE8      Read CPLD code                     0          0         1      4      An IN transfers of Length 4 bytes will
                                                                                return the CPLD Firmware Code.



  Silicon Imaging , Inc. 2004                         Page 24 of 55                               Company Confidential
SI-1300 Sensor Register Programming
Use VR=x94, Index=Register, Value = Value to Load, Dir = 1 (IN), Len = 0

  Index               Description        Value         Setting
  0x00               Chip Version        0x84xx        0x8421 or 0x8431
  0x01                                  0x000C         (First row to be read out + 12)
                      Row Start
                                          (12)
                                        0x0014         (First column to be read out + 14)
  0x02              Column Start                       Register value must be an even number.
                                          (20)
                                        0x03FF         Window height (number of rows - 1)
  0x03             Window Height                       Min = 0x0002.
                                        (1023)
                                                       Window width (number of columns - 1)
                                        0x04FF
  0x04              Window Width                       Register value must be an odd number.
                                        (1279)
                                                       Min = 0x0003
                                        0x0013         Number of extra row blanking clocks + 19
  0x05           Horizontal Blanking                   Row Blanking = 244 clocks + (Regx05 –19)
                                         (19)
                                                       Number of extra rows added into the vertical blanking
                                        0x0019
  0x06            Vertical Blanking                    period. Typically used to slow down frame rate and allow
                                         (25)
                                                       time for register updates between images.
                                        0x0419         Number of rows of integration
  0x09                 Exposure
                                        (1049)
                    Shutter Delay       0x0000         Number of master clocks times four that the sensor waits
  0x0C                                                 before asserting the reset for a given row.
                  (Short Exposure)        (0)
                                                       0   0 (do not change)
                                                       1   0 (do not change)
                                                       2   Column Skip 4—default is 0 (disable), 1 = enable.
                                                       3   Row Skip 4—default is 0 (disable), 1 = enable.
                                                       4   Column Skip 8—default is 0 (disable), 1 = enable.
                    Subsampling         0x80xx
  0x1E                                                 5   Row Skip 8—default is 0 (disable), 1 = enable.
                  & Snapshot Mode       (x8000)        6   0 (do not change).
                                                       7   0 (do not change).
                                                       8   Snapshot Mode—default is 0 (continuous mode).1 = enable
                                                           Snaphsot TRIGGER can come from CC-1 or from serial
                                                            interface command.
                                                       0    No bad frames: 0 (default) = only good frames, 1 = all frames
                                                       1    0 (do not change)
                                                       2    1 (do not change)
                                                       3    Column skip2: 0= normal readout (default), 1= skip by 2
                   Subsampling 2         0x11xx
  0x20                                  (0x1104)
                                                       4    Row skip2:     0 = normal readout (default), 1= skip by 2
                  & Scan Reversal                      5    0 (do not change)
                                                       6    0 (do not change)
                                                       7    Flip Row: 0 = normal, 1= Scan reversal
                                                       8    1 (do not change)
                                       0x0008 (8)
  0x2B              Green1 Gain
                                        1x gain.
                                                                Gain        Increments           Settings
                                       0x0008 (8)            1.000 to 4.000     0.125           0x08 to 0x20
  0x2C                Blue Gain
                                        1x gain.              4.25 to 8.00      0.25            0x51 to 0x60
                                                               9.0 to 15.0       1.0            0x61 to 0x67
                                       0x0008 (8)
  0x2D                Red Gain
                                        1x gain.

                                       0x0008 (8)
  0x2E              Green2 Gain
                                        1x gain.
                     Global Gain       0x0008 (8)            This register can be used to set all four gains at once.
  0x35                                                       When read, it will return the value stored in Reg0x2B.
                                        1x gain.


   Silicon Imaging , Inc. 2004                     Page 25 of 55                                  Company Confidential
Digital Clock Synthesizer Programming
The SI-1300 has a Digital Clock Synthesizer capable of generating a range of frequencies from 7MHz to 40MHz.
The pixel data output rate is the same as the sampling clock rate.

A range of preset frequencies are listed below:
Note: The factory can generate the command to achieve a targeted clock rate.


 Vendor       Function                   Value     Index         DIR     Buffer     Description
 Code                                    16bits    16 bits
 0xE2         Set Clock                  0         0             0       3          An OUT transfer with a length of 3
                                                                                    sets the clock frequency. The Index
              The pixel clock rate of                                               and Value fields are ignored. The
              the SI1280 is the same                                                following table is a list of 3 byte hex
              as the programmed                                                     strings and clock values.
              rate. Therefore, 30MHz
              will be equal to 30MP/s.                                                   10 MHz             30688E
                                                                                         15MHz              328E90
              Warning:                                                                   20 MHz             306886
              The maximum clock                                                          25MHz              30B689
              rate speed allowed will
              be dependant on the                                                        30MHz             37CB8F
              image size, bit depth                                                      35MHz             35D40B
              settings    and     the
              sustained    throughput                                                    40 MHz             306882
              on the USB host                                                            45 MHz             35E709
              controller.
                                                                                         50 MHz             34B689

 0xE2         Get clock                  0         0             1       3          An IN transfers of Length 3 bytes will
                                                                                    return the last used clock setting.

API FUNCTION:

    SI_ReadClockFile(char* cCamClockFile, int* iClockTableSize, CLOCKSETTING* ClockSettings)
SI_SetClock ( int iCamID, int iCamClockMode, CLOCKSETTING* ClockSettings)
SI_SetClockB ( int iCamID, int iClockIndex)
    SI_ReadStatusClock (int iCamID, int* iStatus, int* iClock)
int SI_SetClockB ( int iCamID, int iClockIndex)


                                                  Index                Clock Rate
                                                                         (Mhz)
                                                    0                       7
                                                    1                       8
                                                    2                       9
                                                    3                      10
                                                    4                      15
                                                    5                      20
                                                    6                      25
                                                    7                      30
                                                    8                      35
                                                    9                      40
                                                   10                      45



   Silicon Imaging , Inc. 2004                        Page 26 of 55                               Company Confidential
Frame Timing
 PARAMETER           NAME                      EQUATION (MASTER CLOCK)                       TIMING (48MHz)
                                                                                             1,280 pixel clocks
 A                   Active Data Time          (Reg0x04 + 1)                                 = 26.7µs
                                                                                             242 pixel clocks
 P1                  Frame Start Blanking      242 Clocks
                                                                                             = 5.04µs
                                               (2 + Reg0x05 - 19)                            2 pixel clocks
 P2                  Frame End Blanking                                                      = 0.042µs
                                               (MIN Reg0x05 value = 19)
                                               244 + (Reg0x05 - 19)                          244 pixel clocks
 Q= P 1+ P 2         Horizontal Blanking                                                     = 5.08µs
                                               (MIN Reg0x05 value = 19)
                                               A+Q=                                          1,524 pixel clocks
 Row_Time            Row Time                  ((Reg0x04 + 1) + (244 + Reg0x05 - 19))        = 31.75µs
                                               Min Row_time = 244 + 304 = 548 clocks/row
                                               (Reg0x06 + 1) x (A + Q)                       39,624 pixel clocks
 V                   Vertical Blanking                                                       = 825.5µs
                                               (MIN Reg0x06 value = 15 rows, Default =25)
                                                                                             1,560,576 pixel clocks
 N rows x (A + Q)    Frame Valid Time          (Reg0x03 + 1) x (Row_Time)                    = 32.51ms

                                                                                             1,600,200 pixel clocks
 F                   Total Frame Time          (Reg0x03 + 1 + Reg0x06 + 1) x Row_Time        = 33.34ms / 30fps
                     Total Frame Time                                                        1,600,200 pixel clocks
 F’                                            (Reg0x09 + 1) x Row_Time                      = 33.34ms / 30fps
                     (long integration time)




Note: Typically, the value of Expsoure (Reg0x09) is limited to the number of rows per frame (which includes
vertical blanking rows) such that the frame rate is not affected by the integration time. If Reg0x09 is increased
beyond the total number of rows per frame, the camera will automatically increase vertical blanking (Reg05) as
needed, and therby reduce the effective frame rates.

To calculate the frame rate for any clock rate the equation is estimated by:


                  (         clock rate(Hz)           )       =                    # Frames Per Second (fps)
                ( # of columns + 244) * ( # of rows +25) -180

Example:      What is the frame rate, at 48MHz clock rate for an image size of 1280 x 1024?


                               40 x 106                                      = 25 Frames Per Second (fps)
                        ( 1280 + 244) * (1024+25)
*** Subsampling frame rates are based on the resulting size of the sub-sampled image or window.
*** Minimum # of columns that are internally clocked is 304, even if the image window is smaller. Therefore the
minimum row time = 304 + 244 = 548 clocks.



    Silicon Imaging , Inc. 2004                            Page 27 of 55                         Company Confidential
Frame Timing Registers
  Register                Name           Default                             Description

                                         0x03FF       Window height (number of rows - 1)
     0x03            Window Height                    Min = 0x0002.
                                         (1023)
                                                      Window width (number of columns - 1)
                                         0x04FF
     0x04            Window Width                     Register value must be an odd number.
                                         (1279)
                                                      Min = 0x0003
                                         0x0013       Number of extra row blanking clocks + 19
     0x05         Horizontal Blanking                 Row Blanking = 244 clocks + (Regx05 –19)
                                          (19)
                                                      Number of extra rows added into the vertical blanking
                                         0x0019
     0x06           Vertical Blanking                 period. Typically used to slow down frame rate and allow
                                          (25)
                                                      time for register updates between images.



API FUNCTION:

        SI_InitWindowMode (int iCamID, int iStartRow, int iEndRow, int iStartColumn, int iEndColumn, int
        iFrameTime, int iExposureTime)
        SI_SetVerticalBlanking(int( iCamID, int iVertBlanking);
        SI_SetHorizontalBlanking(int( iCamID, int iVertBlanking);




   Silicon Imaging , Inc. 2004                    Page 28 of 55                            Company Confidential
Exposure Time (Reg09)
The exposure time is set by adjusting the number of row times in the exposure register (Reg09), up to the number
of rows in the frame. For longer exposures, the frame time can be extended beyond the normal 1024 rows by
increasing vertical blanking (Reg05).

                     Exposure_Time = (Row_Time x Reg09) – 180 clocks
                                     Reg09 = Rows of integration

                     Row_Time              = Width + 244 + Horizontal Blanking
                                           = (Reg04 + 1) + 244 + (Reg05 - 19)
                                              Reg04 = Width-1
                                              Reg05 = Vertical Blanking (min =19)
Note: Typically, the value of Reg0x09 is limited to the number of rows per frame (which includes vertical blanking
rows) such that the frame rate is not affected by the integration time. If Reg0x09 is increased beyond the total
number of rows per frame, the camera will automatically increase vertical blanking (Reg05) as needed, and
therby reduce the effective frame rates.

API FUNCTION:

                  SI_SetExposureValue (int iCamID, int iExposure)


Exposure_Time in Subsampling & Anti-Flicker

Row skip mode should have no effect on the integration time.

Column skip mode changes the effective value of Column Size (Reg0x04) as follows:

                  Column Skip 2 =>         Reg04eff = (int(Regx04 / 4) x 2) + 1
                  Column Skip 4 =>         Reg04eff = (int(Regx04 / 8) x 2) + 1
                  Column Skip 8 =>         Reg04eff = (int(Regx04 / 16) x 2) + 1

where the int() function truncates to the next lowest integer. R4eff in the equation for Row_Time instead of Reg04

The Exposure_Time should be adjusted to avoid banding in the image from light flicker. Under 60Hz flicker, this
means Exposure_Time must be a multiple of 1/120 of a second. Under 50Hz flicker, Exposure_Time must be a
multiple of 1/100 of a second.

Short Exposure ( Less than 1 Row Time) (Regx0C)
To set the SI1300 to an integration time less than 1 row, the shutter width register 0x09 must first be set to 1.
Shorter integration times are controlled by the shutter delay register 0x0C. The following formula shows how to
calculate the of shutter delay for a desired sub-row integration time:

                 fclk = 48MHz
                 Win_width = 1279
                 Win_height = 1023
                 Desired integration time, Tint = 15us ( equivalent to 0.472 x row_time )

                      shutter _ width  win _ width  1  horiz _ blank  244  Tint  f clk  180
    shutter _ delay 
                                                            4
                      1  1279  1  0  244  15  10  48  106  180
                                                        6
    shutter _ delay                                                       156
                                                4


    Silicon Imaging , Inc. 2004                      Page 29 of 55                            Company Confidential
Below is a table describing the maximum and minimum limitations of shutter width register exposure control for
various pixel readout frequency and frame rates:

                                                Exposure Time Table
                           Shutter Width         Exposure time [ms]    Exposure Time [ms]
                          Reg 0x09 [rows]        24 MHz pixel clock     12 MHz pixel clock

                             1 (minimum)               0.056                  0.112
                                    2                  0.120                  0.239
                                   16                   1.01                  2.02
                                   64                   4.06                  8.12
                                   512                  32.5                  65.0
                            1049 (default)              66.6                   133
                                   2098                 133                    266
                                   4196                 266                    533
                         16383 (maximum)                1040                  2080


The table below shows examples of fine exposure control for short exposure settings:

                                             Fine Exposure Control Table
                            Shutter Width            Shutter Delay     Exposure Time [us]
                              Reg 0x09                 Reg0x0C              48MHz
                               [rows]                [pixel clocks]       pixel clock

                              1 (minimum)            0 (minimum)              28.00
                                     1                     1                  27.92
                                     1                     2                  27.83
                                     1                     3                  27.67
                                    ---                    ---                  ---
                                    ---                    ---                  ---
                                     1                    242                 7.833
                                     1              243 (maximum)      7.750 (minimum exp)

The fine exposure table shows that the minimum integration time possible using the SI1300 with default
1280x1024 readout at 48MHz is 7.75us.

API FUNCTION:

                  SI_SetShutterDelay (int iCamID, int iShutterDelay)




    Silicon Imaging , Inc. 2004                      Page 30 of 55                          Company Confidential
Window Programming – Image Size & Position
To place a 640 x 480 window in the middle of the sensor,

Reg 01 xxxx       Set BEGIN_ROW to 256+12           (0x020Ch)
Reg 02 xxxx       Set BEGIN_COLUMN 320+14           (0x014eh)
Reg 03 xxxx       Set HEIGHT to (480 – 1) = 479     (0x01DFh)
Reg 04 xxxx       Set WIDTH to (640– 1) = 639       (0x027Fh)

As shown in the adjacent picture, registers 3 and 4 set the size of
the display window. Register 2 sets the column start location and
registers 1 and 1 set the row start location. Column and Row end
do not need to be entered as they are the sum of the start and
size of the window.

Note: other custom commands can be used to move the window
at high speeds – please consult the factory.


   Register                Name           Default                               Description

      0x01                                0x000C       (First row to be read out + 12)
                         Row Start
                                            (12)

                                           0x0014      (First column to be read out + 14)
      0x02             Column Start                    Register value must be an even number.
                                            (20)

                                          0x03FF       Window height (number of rows - 1)
      0x03            Window Height                    Min = 0x0002.
                                          (1023)
                                                       Window width (number of columns - 1)
                                          0x04FF
      0x04            Window Width                     Register value must be an odd number.
                                          (1279)
                                                       Min = 0x0003



The following table shows frame rates of typical image formats and pixel clock frequencies. This table assumes
that the shutter width register 0x09 is set to the number of rows in the image format + 25 rows for vertical
blanking. Note that it is possible to fine tune the desired frame rate by adjusting the horizontal blank register
0x05, vertical blank register 0x06, and the shutter delay register 0x0C:

                   Maximum Frame Rates For Typical Pixel Clocks and Image Output Formats

                        Pixel Clock       1280x1024             640x480             320x240
                           [MHz]           (SXGA)                (VGA)              (QVGA)
                                             [fps]                [fps]               [fps]
                              40             24.6                     44                 160


API FUNCTION:

SI_InitWindowMode (int iCamID, int iStartRow, int iEndRow, int iStartColumn, int iEndColumn, int iFrameTime,
int iExposureTime)
SI_SetRowStartEnd (int iCamID, int iStartRow, int iEndRow)
SI_SetColStartEnd (int iCamID, int iStartColumn, iEndColumn)
     SI_SetWindowPosition (int iCamID, int iStartRow, int iStartColumn)
     SI_SetWindowPositionExposure (int iCamID, int iStartRow, int iStartColumn, int iExposureTime)



    Silicon Imaging , Inc. 2004                    Page 31 of 55                              Company Confidential
SubSampling / View-finder Modes
The SI1300 has several view-finder modes that skip rows and columns of data to allow readout of smaller
amounts of image data without sacrificing scene content. The following view-finder modes are available:

            Mode                                   Default                  Skip 2                Skip 4                Skip 8
                                                  (no skip)                Columns               Columns               Columns
            Default (no skip)                    1280x1024                 640x1024              320x1024              160x1024
            Skip 2 Row                           1280x512                  640x512               320x512               160x512
            Skip 4 Rows                          1280x256                  640x256               320x256               160x256
            Skip 8 Rows                          1280x128                  640x128               320x128               160x128

Note: Imager frame rate is increased for view-finder modes. Horizontal and vertical blank registers may be
increased to adjust the frame rate to desired rate.

Example: 320x256 preview mode

                                              320x256 Skip 4 View Finder Mode




              Row 1
              Row 2
                                                                          Increase Horizontal and Vertical Blank Time To Keep Frame
                                                                                                Rate Constant
              LVAL


                    LVAL is only asserted high for 320 pixels, overall line time
                                       remains unchanged


API FUNCTION:

                  SI_SetSubsampleMode (int iCamID, int iSubSampMode)




    Silicon Imaging , Inc. 2004                                    Page 32 of 55                                          Company Confidential
GAIN CONTROL (Reg 2B, 2C, 2D, 2E, 35)
The SI1300 contains manual analog gain controls for each color channel (G1, G2, R, B). Gain values may be set
using the following registers: G1 = 0x2B [6..0], G2 = 0x2E [6..0], R = 0x2D [6..0], and B = 0x2C [6..0]. In addition,
the SI1300 contains a global gain register, 0x35 [6..0], that applies the gain value to all gain channels (G1, G2, R
,B ). When the global gain register is read it returns only the gain setting from the Green 1 channel register 0x2B.

                                                0x0008 (8)       Gain               Increments        Settings
     0x2B             Green1 Gain                                1.000 to 4.000       0.125         0x08 to 0x20
                                                 1x gain.
                                                                 4.25 to 8.00          0.25         0x51 to 0x60
                                                0x0008 (8)        9.0 to 15.0          1.0          0x61 to 0x67
     0x2C               Blue Gain
                                                 1x gain.    Formula for gain setting:
                                                0x0008 (8)          Gain ≤8
     0x2D                Red Gain                                      Gain = (bit[6] + 1) x (bit[5-0] x 0.125)
                                                 1x gain.
                                                                    Gain > 8 (bit[6] = 1 and bit[5] = 1)
                                                0x0008 (8)              Gain = 8.0 + bit[2-0]
     0x2E             Green2 Gain
                                                 1x gain.
                       Global Gain              0x0008 (8)        This register can be used to set all four gains at once.
      0x35                                                        When read, it will return the value stored in Reg0x2B.
                                                 1x gain.


API FUNCTION:

    SI_SetGlobalGain (int iCamID, int iGain)
    SI_SetGlobalGainB (int iCamID, int iGainIndex)
    SI_GetGainString((int iCamID, int iGainIndex, char** cGain)
    SI_SetRGBGain(int iCamID, int iRedGain, int iGreenGain, int iBlueGain)
    SI_SetRGGBGain(int iCamID, int iRedGain, int iGreenGain1, int iGreenGain2, int iBlueGain)
    SI_SetRGBGainB(int iCamID, int iRedGainIndex, int iGreenGainIndex, int iBlueGainIndex)



                                   GAIN INDEX            SI1300
                                        1                1.000
                                        2                1.125
                                        3                1.250
                                        4                1.375
                                        5                1.500
                                        6                1.625
                                        7                1.750
                                        8                1.875
                                        9                2.000
                                       10                2.125
                                       11                2.250
                                       12                2.375
                                       13                2.500
                                       14                2.625
                                       15                2.750
                                       16                2.875
                                       17                3.000
                                       18                3.125
                                       19                3.250
                                       20                3.375




    Silicon Imaging , Inc. 2004                         Page 33 of 55                              Company Confidential
The table below shows recommended gain register settings and corresponding gain values:

    Register Setting (0x2B,              Gain                        Register Setting (0x2B,            Gain
   0x2C, 0x2D, 0x2E, 0x35)                                          0x2C, 0x2D, 0x2E, 0x35)
    Decimal          Hex          Gain      Gain [dB]                Decimal          Hex        Gain     Gain [dB]
              8          0x08           1            0                        32          0x20        4         12.0
              9          0x09      1.125           1.0                        81          0x51     4.25         12.6
             10          0x0A       1.25           1.9                        82          0x52      4.5         13.1
             11          0x0B      1.375           2.8                        83          0x53     4.75         13.5
             12          0x0C         1.5          3.5                        84          0x54        5         14.0
             13         0X0D       1.625           4.2                        85          0x55     5.25         14.4
             14          0x0E       1.75           4.9                        86          0x56      5.5         14.8
             15          0x0F      1.875           5.5                        87          0x57     5.75         15.2
             16          0x10           2          6.0                        88          0x58        6         15.6
             17          0x11      2.125           6.5                        89          0x59     6.25         15.9
             18          0x12       2.25           7.0                        90          0x5A      6.5         16.3
             19          0x13      2.375           7.5                        91          0x5B     6.75         16.6
             20          0x14         2.5          8.0                        92         0x5C         7         16.9
             21          0x15      2.625           8.4                        93         0x5D      7.25         17.2
             22          0x16       2.75           8.8                        94          0x5E      7.5         17.5
             23          0x17      2.875           9.2                        95          0x5F     7.75         17.8
             24          0x18           3          9.5                        96          0x60        8         18.1
             25          0x19      3.125           9.9                        97          0x61        9         19.1
             26          0x1A       3.25          10.2                        98          0x62       10         20.0
             27          0x1B      3.375          10.6                        99          0x63       11         20.8
             28          0x1C         3.5         10.9                      100           0x64       12         21.6
             29          0x1D      3.625          11.2                      101           0x65       13         22.3
             30          0x1E       3.75          11.5                      102           0x66       14         22.9
             31          0x1F      3.875          11.8                      103           0x67       15         23.5




   Silicon Imaging , Inc. 2004                     Page 34 of 55                                Company Confidential
SI USB2.0 DIRECT API FUNCTIONS

USB COMMANDS
SI_OpenCamera (int iCamID, PCHAR devname)
SI_CloseCamera (int iCamID)

INITIALIZE CAMERA SETTINGS
SI_InitWindowMode (int iCamID, int iStartRow, int iEndRow, int iStartColumn, int iEndColumn, int iFrameTime, int
iExposureTime)

IMAGE TRANSFER
SI_SnapBulkImage (int iCamID, int iColumns, int iRows, int iPixelDepth, unsigned char* ImageBuffer, int* iBytesRead)
SI_SetImageBuffers (int iCamID, unsigned char* pBuffer1, unsigned char* pBuffer2)
SI_SnapBulkDoubleBuffer (int iCamID, int iColumns, int iRows, int iPixelDepth, int iCaptureBuffer, HANDLE hEvent, int*
iBytesRead)
SI_SnapBulkLiveStart(int iCamID, int iColumns, int iRows, int iPixelDepth, int iSequenceCount, unsigned char* ImageBuffer,
HANDLE hEvent1, HANDLE hEvent2, HANDLE hEvent3)
     SI_SnapBulkLiveStop(int iCamID))

    GENERIC CAMERA REGISTER COMMAND
    SI_TransferControlData (int iCamID, int iVendorRequestCode, int iIndex, int iValue, int iDirection, int iBufferSize,
    unsigned char* buffer)

    EXPOSURE & GAIN
SI_SetExposureValue (int iCamID, int iExposure)
    SI_SetGlobalGain (int iCamID, int iGain)
    SI_SetGlobalGainB (int iCamID, int iGainIndex)
    SI_GetGainString((int iCamID, int iGainIndex, char** cGain)
    SI_SetRGBGain(int iCamID, int iRedGain, int iGreenGain, int iBlueGain)
    SI_SetRGGBGain(int iCamID, int iRedGain, int iGreenGain1, int iGreenGain2, int iBlueGain)
    SI_SetRGBGainB(int iCamID, int iRedGainIndex, int iGreenGainIndex, int iBlueGainIndex)
SI_SetBlackOffset (int iCamID, int iBlackOffset)
SI_SetADC (int iCamID, int iADC)
SI_SetGPIO (int iCamID, int iIONumber, int iStatus)
SI_SetShutterDelay (int iCamID, int iShutterDelay)

    CLOCK
    SI_ReadClockFile(char* cCamClockFile, int* iClockTableSize, CLOCKSETTING* ClockSettings)
SI_SetClock ( int iCamID, int iCamClockMode, CLOCKSETTING* ClockSettings)
SI_SetClockB ( int iCamID, int iClockIndex)
    SI_ReadStatusClock (int iCamID, int* iStatus, int* iClock)


    WINDOW SIZE, POSITION & FRAME TIME
SI_SetFrameTime (int iCamID, int iFrameTime)
SI_SetRowStartEnd (int iCamID, int iStartRow, int iEndRow)
SI_SetColStartEnd (int iCamID, int iStartColumn, iEndColumn)
    SI_SetWindowPosition (int iCamID, int iStartRow, int iStartColumn)
    SI_SetWindowPositionExposure (int iCamID, int iStartRow, int iStartColumn, int iExposureTime)
    SI_SetVerticalBlanking(int( iCamID, int iVertBlanking);
    SI_SetHorizontalBlanking(int( iCamID, int iVertBlanking);

    BIT-DEPTH & SUBSAMPLING
SI_SetSubsampleMode (int iCamID, int iSubSampMode)
    SI_SetPixelDepth (int iCamID, int iPixelDepth)


    FIRMWARE & PRESETS
    SI_ReadSerialNumber (int iCamID, char* cCamSerialNumber)
    SI_ReadVersion (int iCamID, char* cCamVersion)
    SI_TransferFirmware(int iCamID, char* cFirmwareFile, int iDirection)




    Silicon Imaging , Inc. 2004                        Page 35 of 55                                Company Confidential
                                Snap & Live Mode Capture
There are two methods by which image data can be retrieved from a Silicon Imaging USB camera: Snap Mode
& Live Mode. The snap mode is the simplest method to capture an image from the camera. The live mode is
used for continuous image capture for live display or high-speed sequence capture.

                                               Snap Mode
The first method, which we will call “Snap Mode”, typically involves use of the SI_SnapBulkImage() function.
to retrieve one image from the camera and transfer it into a buffer created at the application level. For this
method, application level interaction is required to request every image captured. This is ideal for hardware-
triggered or software initiated events. The camera may be placed in a stopped or non-scanning mode with a
the optional (-T) Trigger model, by issuing the command SI_ArmTriggerWait(). Once the trigger event
occurs, the snap command is sent to the camera to initiate exposure and perform readout. The function
returns to the application layer with the image buffer filled with new data. The captured image is typically
processed and displayed in a GUI application. The process is then repeated, often as a single threaded
application.

 Sample:

 int result;
 BYTE commandClock[3] = {0x37, 0xCB, 0x8F};               // clock settings for 30 MHz
 int iColumns, iRows, iSize, iPixelDepth, iBytesRead;
 char driver[8] = "ezusb-0";
 unsigned char* ImageBuffer;

  iRows = 512;
  iColumns = 512;
  iPixelDepth = 8;
  iSize = iRows * iColumns;

 // open camera
   result = SI_OpenCamera (0, driver);      // camera 0
   if (SI_STATUS_SUCCESS != result)
       return result;

  ImageBuffer = (unsigned char *) malloc(iSize);

 // set image size in camera
    SI_InitWindowMode(0, 0, iRows , 0, iColumns, 0, 0);

 // set clock
    SI_TransferControlData(0, 0xE2, 0, 0, 0, 3, commandClock);

 // Wait for External TTL trigger
    SI_ArmTriggerWait(1);

 // snap single image
    result = SI_SnapBulkImage(0, iColumns, iRows, iPixelDepth, image, &iBytesRead);

   if (SI_STATUS_SUCCESS != result)
      return result;

 // free memory
    free(pImageBuffer1);

 // close camera
    SI_CloseCamera(0);


 Silicon Imaging , Inc. 2004                   Page 36 of 55                              Company Confidential
The minimum delay between the completion of one capture and the initiation of another capture at the camera
level is unknown in a Windows programming environment and might vary from 1-3 ms. Therefore, in a continuous
capture operation with fixed timing between frame (vertical blanking) to allow for the variations, the maximum
consistent frame rate will be limited by the maximum time delay or vertical blanking. For example, If the readout
of a frame takes 30msec and the maximum delay which may occur is 3msec until the next frame begin can be
initiated, the frame time must be set to 33msec (30 + 3msec) to maintain smooth continuous motion video.



                                                                   NO
                                                                  XFER

                    30msec         (3) 30msec (3)   30msec (3) 30msec (3) 30msec (3)
       SNAP




If the application is delayed in its request beyond the 3 msec vertical blanking delay, the next frame will internally
scan inside the camera, but will not be transferred out to the host. This is done maintain consistent frame-to-
frame timing and correct exposure in rolling shutter operation. The image cannot start in the middle of the frame,
so the next image starting at the top of frame will be transferred to complete the snap request.



Live Mode

With the second method, which we call “Live Mode” can be used to capture continuously or for a specified
number of images by the camera driver without any user level application intervention.

The functions SI_SnapBulkLiveStart and SI_SnapBulkLiveStop are the primary functions employed for this
method.




Key Functions for Live Mode:

SI_SnapBulkLiveStart (int iCamID, int iColumns, int iRows, int iSequenceNumber, unsigned char* ImageBuffer,
HANDLE hEvent1, HANDLE hEvent2, HANDLE hEvent3)


SI_SnapBulkLiveStop (int iCamID)

These functions are documented in greater detail in the API User’s Manual



Note: All Silicon Imaging USB cameras support live mode with the exception of the SI3170.




    Silicon Imaging , Inc. 2004                       Page 37 of 55                             Company Confidential
                       High-level Description of Continuous Live Mode
Continuous live mode is illustrated in the diagram below. The application creates a buffer which is twice the
size of a modulo 512 single image. If the image is monochrome and 1024 x 768 in size, the total buffer size
would be 2 x 1024 x 768 or 1572864 bytes since the image size is already modulo 512 (if the image size is not
modulo 512, it should be increased to the next multiple of 512). Thus each of the halves of this buffer (Buffer 1
and Buffer 2) will contain one image. If the mode is color the size of the overall buffer should be doubled.

After the usual control functions are called such as SI_InitWindowMode, the continuous capture process is
initiated by a call to SI_SnapBulkLiveStart with the iSequenceCount parameter set to zero. Prior to this call,
the application will have created the two events for notification (event1 and event2). SI_SnapBulkLiveStart
will not return to the user until the continous capture process is terminated (see below).

The first captured image will be transferred into Buffer 1 and Event1 set immediately after that transfer is
completed. At this point display and processing can be done from Buffer 1 while the second image is captured
into Buffer 2. Event2 is set immediately upon the fill of Buffer 2. The process continues by alternating the fill
and setting of events between Buffers 1 and 2. If processing and display on one buffer is not completed prior to
the other buffer being filled, the camera will simply start writing over the buffer that you are working with. Thus
the capture of any image cannot held up from the application level. If the capture rate will exceed the display
and processing rate the user should use the single snap function SI_SnapBulkImage which initiates a capture
with every call from the application level.



                                      Buffer 1                 Buffer 2




                                                                                   User Level
                                             1.)       SIUSB.
                                                       DLL



                                             Silicon Imaging                      Kernel Level
                                            Camera USB Driver
                                                ezusb.sys



                                   Control Data               Image Data




                                                    Silicon
                                                   Imaging
                                                   Camera




 Silicon Imaging , Inc. 2004                      Page 38 of 55                             Company Confidential
Typically, the function SI_SnapBulkLiveStart will be called from a separate thread created from a main
thread. To stop the continuous live capture process, the user should call SI_SnapBulkLiveStop from the
main or another thread. The capture process will then terminate when the current image is finished being
captured. At that point, SI_SnapBulkLiveStart will return to the user.

                          High-level Description of Sequenced Live Mode
Sequenced live mode is employed when the user wishes to capture a finite sequence of images at the highest
possible speed rate. As with continuous mode, the user will call SI_SnapBulkLiveStart with the
iSequenceCount parameter set to the number of images “N” to be sequentially captured. Instead of a buffer
large enough to hold two images with continuous mode, the user should size the buffer to accommodate N
images. The capture will transfer the N images into the contiguous buffer at the appropriate point, (e.g. the
third image would start filling at a pointer position of twice the image size plus one).

The arguments for the events should be set to NULL as there is no notification with this mode. The
SI_SnapBulkLiveStart function will return as soon asall the n images are captured and transferred. At this
point the user can display and process all of the images.




    Buffer                                                                                             Buffer
     1                                                                                                 N




                                                                                   User Level
                                            2.)       SIUSB.D
                                                       LL



                                             Silicon Imaging                      Kernel Level
                                            Camera USB Driver
                                               (ezusb.sys)



                                  Control Data                    Image Data




                                                    Silicon
                                                   Imaging
                                                   Camera




 Silicon Imaging , Inc. 2004                     Page 39 of 55                           Company Confidential
Example of Continuous Live Mode

 This code sample shows a sample control function and associated threads for the actual capture and display.


 void CSI004Doc::OnActionLiveStart()                                         // main controlling function
 {
       if(!InitCapture()) return;

           m_bStopLiveFlag = 0;
           SI_InitWindowMode(0, 0, m_Height - 1, 0, m_Width - 1, 0, 2000);

       m_hEvent1 = ::CreateEvent(NULL, FALSE, FALSE, NULL);
       m_hEvent2 = ::CreateEvent(NULL, FALSE, FALSE, NULL);
         m_hEvent3 = ::CreateEvent(NULL, FALSE, FALSE, NULL);
       m_hLiveThread =
       ::CreateThread(NULL,0,LiveThreadFunc,this,CREATE_SUSPENDED,NULL);
         m_hLiveDisplayThread =
 ::CreateThread(NULL,0,LiveDisplayThreadFunc,this,CREATE_SUSPENDED,NULL);

           ::ResumeThread(m_hLiveThread);
           ::ResumeThread(m_hLiveDisplayThread);

               .             .
       SI_SnapBulkLiveStop(0);
       ::CloseHandle(m_hEvent1);
       ::CloseHandle(m_hEvent2);
 ::CloseHandle(m_hEvent3);
       ::CloseHandle(m_hLiveThread);
       ::CloseHandle(m_hLiveDisplayThread);

           return;

 }


DWORD WINAPI CSI004Doc::LiveThreadFunc(LPVOID pParam)                    // capture thread
 {
     CSI004Doc * pDoc = static_cast<CSI004Doc*>(pParam);
     int sts;

            int iSize = 2 * iDepth * (pDoc->m_Width * pDoc->m_Height); // for mono
           pDoc->pDBuffer2 = new BYTE[iSize];

           // initiate continuous capture – thread is held
           sts = SI_SnapBulkLiveStart(0, pDoc->m_Width, pDoc->m_Height, 8,
              pDoc->pDBuffer2, 0, pDoc->m_hEvent1, pDoc->m_hEvent2, pDoc->m_hEvent3 );


           if (sts != SI_STATUS_SUCCESS)
                     AfxMessageBox("continuous capture error");

           delete [](pDoc->pDBuffer2);

           return 0;

 }



      Silicon Imaging , Inc. 2004                   Page 40 of 55                           Company Confidential
DWORD WINAPI CSI004Doc::LiveDisplayThreadFunc (LPVOID pParam)         // display thread
 {

        int iBuffer, ret;
        HANDLE hEventArray[3];
        CSI004Doc * pDoc = static_cast<CSI004Doc*>(pParam);
        hEventArray[0] = pDoc->m_hEvent1;
        hEventArray[1] = pDoc->m_hEvent2;
        hEventArray[2] = pDoc->m_hEvent3;


        CSI004Doc * pDoc = static_cast<CSI004Doc*>(pParam);


        // Prepare the Bitmap data structure for display here
                         .
                         .
                         .
        while (!pDoc->m_bStopLiveFlag)
        {
                         .
                         .
                         .

                // wait for any event to come in
        ret = WaitForMultipleObjects(3, hEventArray, FALSE, 20000);

        if ((ret - WAIT_OBJECT_0) == 0)
        {
        TRACE("buffer 0 captured\n");
        }
        else if ((ret - WAIT_OBJECT_0) == 1)
        {
        TRACE("buffer 1 captured\n");
        }
        else
        {
        TRACE("short image captured\n");
        }




           // display appropriate buffer here
                                  .
                                  .
                                  .

  }
  delete [] pBmi;
  return 0;




   Silicon Imaging , Inc. 2004                     Page 41 of 55                         Company Confidential
                                    Example of Sequenced Live Mode

Description

This code sample demonstrates sequenced live mode.



Sample Code:


void CSI004Doc::OnActionSequencedLiveStart()
{
       if(!InitCapture()) return


          // allocate sequence of buffers

          int iSize = iDepth * m_Width * m_Height * m_SnapCount;

          PBYTE pBuffer = new BYTE[iSize];

       // Prepare the Bitmap data structure for display here
                 .
                 .
       // start sequence capture
       // hEvent1 is set after each image in the sequence is captured
       // if an image is short hEvent3 is set
       sts = SI_SnapBulkLiveStart(0, m_Width , m_Height, 8, pBuffer, m_SnapCount, hEvent1, NULL,
hEvent3);

          if (sts != SI_STATUS_SUCCESS)

                    AfxMessageBox("capture sequence error");


          for (int j = 0; j < m_SnapCount; j++)
          {
                     display all images sequentially after all captures completed

                    .
                    .
                    .
          }

          delete [] pBmi;
          delete [] pBuffer;

          return;
}




     Silicon Imaging , Inc. 2004                      Page 42 of 55                  Company Confidential
                                Binary to Hex (ASCII) Table
                                      Binary        Hex in ASCII
                                       0000               0
                                       0001               1
                                       0010               2
                                       0011               3
                                       0100               4
                                       0101               5
                                       0110               6
                                       0111               7
                                       1000               8
                                       1001               9
                                       1010               a
                                       1011               b
                                       1100               c
                                       1101               d
                                       1110               e
                                       1111               f




 Silicon Imaging , Inc. 2004              Page 43 of 55           Company Confidential
                                   FRONT VIEW




                                SENSOR PACKAGING




 Silicon Imaging , Inc. 2004        Page 44 of 55   Company Confidential
                       SI-1300 USB ENCLOSURE DIMENSIONS




 Silicon Imaging , Inc. 2004       Page 45 of 55         Company Confidential
                                SI-1300R Bottom View




 Silicon Imaging , Inc. 2004          Page 46 of 55   Company Confidential
                                SI-1300R Front View




 Silicon Imaging , Inc. 2004         Page 47 of 55   Company Confidential
                                SI-1300R Side View




 Silicon Imaging , Inc. 2004        Page 48 of 55   Company Confidential
                                SI-1300 Spectral Response Curve




 Silicon Imaging , Inc. 2004               Page 49 of 55         Company Confidential
                   SI1300-RGB Cover Glass Filter Response (IRC-30)




 Silicon Imaging , Inc. 2004         Page 50 of 55              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    R   G    R
                                                     B    G   B    G
                                                     G    R   G    R
                                                     B    G   B    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. 2004                       Page 51 of 55                               Company Confidential
1.1 Interpolating red and blue components

                                             G      B G                   G    R     G
                                             R      G R                   B    G     B
                                             G      B G                   G    R     G
                                                   (a)                        (b)

                                             B      G B                   R   G R
                                             G      R G                   G   B G
                                             B      G B                   R   G R
                                                   (c)                        (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.

                                             R1                                     B1
                                             G1                                     G1
                                   R4   G4   R     G2   R2            B4      G4    B     G2   B2
                                             G3                                     G3
                                             R3                                     B3
                                             (a)                                    (b)

                               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 |
                                      1    2    3       4        1    3      2    4

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 R2 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. 2004                          Page 52 of 55                             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 |
                                      1    2    3       4        1    3      2    4

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.504 G  0.098 B  16
                                                                              (2.1)
                                      U  0.439 R  0.368 G  0.071 B  128
                                      V  0.148 R  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  3736B  / 215             (2.2)
                                   U  21208R  16941G  3277B  / 2
                                                           15
                                                                           128
                                   V   4784R  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)
                                                                                                            (2.3)
                            G  1.164(Y  16)  0.813(U  128)  0.391(V  128)
                            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
                                                              (3.1)
                                                   Gwb  AG G
                                                   Bwb  AB B

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
                                               y  Cx  v (3.2)


    Silicon Imaging , Inc. 2004                       Page 53 of 55                       Company Confidential
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
                       T
space, v  (16,128,128) , and C is the appropriate matrix of conversion coefficients. Similarly, (3.1) can be
written as
                                          x wb  Ax (3.3)

where  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 .
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 CD
                                                                                         1 1
                                                                                                 DC1 [5], we        
get that white balance operation in the YUV domain is

                                                  y wb  DC1 y  v   v  CAC1 y  v   v (3.5)
Expressing components of y wb from (3.5) we get

        Y         ( 0.299 AR  0.587 AG  0.114 AB )(Y  16)  ( 0.410AR  0.410AG )(U  128)  ( 0.197 AG  0.198AB )(V  128)  16
            wb
        U         ( 0.511AR  0.428AG  0.008AB )(Y  16)  ( 0.701AR  0.299 AG )(U  128)  ( 0.144 AG  0.143AB )(V  128)  128
            wb
        V         ( 0.172 AR  0.339 AG  0.511AB )(Y  16)  ( 0.236AR  0.237 AG )(U  128)  ( 0.114 AG  0.886AB )(V  128)  128
            wb


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 32-
    bit MCU,” IEEE Trans. Consumer Electronics, vol. 44, no. 4, November 1998.
{3} http://www.northpoleengineering.com/rgb2yuv.htm




    Silicon Imaging , Inc. 2004                                   Page 54 of 55                                       Company Confidential
                                                Contact Information


                                         Silicon Imaging, Inc.
                                                        www.siliconimaging.com
                                                       sales@siliconimaging.com



Ordering Information

    SI-1300U -M or -RGB             1.3 Megapixel USB2.0 Camera, M=Monochrome, RGB= Bayer Color
    -PCB or -R                      PCB (33x40mm) or ‘R’ Round (27mm) Version of Camera. No housing included.
    -T                              External Trigger & strobe with 3-Pin Connection and Trigger/Strobe Breakout Cable
    -X                              External Clock-In & Clock out camera. Must be ordered as a Master-Slave configuration
    CBL-3PT                         Cable, 3Pin Tajimi to TTL Trigger-In & Strobe Out




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., 2004

                                                                 080304-Rev 1.2




     Silicon Imaging , Inc. 2004                                 Page 55 of 55                                          Company Confidential

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:3
posted:2/8/2012
language:
pages:55