Camera Library Overview

The TWL system includes two cameras. Although cameras can be controlled separately, it is not possible to get images from both cameras simultaneously.

The Camera library cannot be used in CODEC-DS mode. Always use it in CODEC-TWL mode.

Use the API to operate the camera.

Basic Camera Specifications

The basic camera specifications are listed below.

Of these specifications, Resolution, Effects, and Flipping are capable of handling two contexts for each camera. It can be faster to switch contexts than to set the specifications separately.
The library automatically puts the cameras in standby mode when the hardware is reset or put to sleep. To enable the camera after recovering from sleep, the application must implement the process.

Default Camera Settings

Contexts handle the following default values when the cameras are started (when the CAMERA_Init function is called).

Inner Camera: Context A
ResolutionCAMERA_SIZE_DS_LCD
EffectCAMERA_EFFECT_NONE
FlippingCAMERA_FLIP_HORIZONTAL

Inner Camera: Context B
ResolutionCAMERA_SIZE_VGA
EffectCAMERA_EFFECT_NONE
FlippingCAMERA_FLIP_HORIZONTAL

Outer Camera: Context A
ResolutionCAMERA_SIZE_DS_LCD
EffectCAMERA_EFFECT_NONE
FlippingCAMERA_FLIP_NONE

Outer Camera: Context B
ResolutionCAMERA_SIZE_VGA
EffectCAMERA_EFFECT_NONE
FlippingCAMERA_FLIP_NONE

By default, both the inner and outer cameras are in context A.

Contexts do not handle the following default values.

Inner Camera
Frame rateCAMERA_FRAME_RATE_15
Photo modeCAMERA_PHOTO_MODE_PORTRAIT

Outer Camera
Frame rateCAMERA_FRAME_RATE_15
Photo modeCAMERA_PHOTO_MODE_NORMAL


Common settings for the inner and outer cameras take the following default values.

Output FormatCAMERA_OUTPUT_YUV
Number of Lines to Transfer1 line

See the links for specific descriptions of the parameter meanings.

RGB Conversion

The camera gets image data in the YCrYCb (YUV4:2:2) format or the RGB (RGB5:5:5) format.

YUV422 is converted into RGB8:8:8 as follows.

R = 1.000 x Y                     + 1.402 x (V - 128)
G = 1.000 x Y - 0.344 x (U - 128) - 0.714 x (V - 128)
B = 1.000 x Y + 1.772 x (U - 128)

The results of the calculation are rounded off if they are less than 0 or more than 255. Then they are scaled to the range [0-31], after which they are in RGB555 format.

The formulas for the reverse conversion (that is, converting RGB555 to YUV422) are shown below.

Y =  0.299 x R + 0.587 x G + 0.114 x B
U = -0.169 x R - 0.331 x G + 0.500 x B + 128
V =  0.500 x R - 0.419 x G - 0.081 x B + 128

See Also

CAMERA Function List

Revision History

2009/06/09 Updated Basic Camera Specifications.
2008/10/06 Described the Camera library's CODEC mode restrictions.
2008/09/11 Added a description of the camera's initial values.
2008/04/21 Added photo mode to the camera's initial values.
2008/03/17 Added a description of operations during hardware reset and during sleep mode.
2007/11/14 Initial version.


CONFIDENTIAL