OV5640 Camera Module Software Application Notes
OV5640 Camera Module
Software Application Notes
Last Modified: May. 25
th
, 2011
Document Revision: 1.3
OmniVision Technologies, Inc. reserves the right to make changes without further notice to
any product herein to improve reliability, function or design. OmniVision does not assume
any liability arising out of the application or use of any project, circuit described herein;
neither does it convey any license under its patent nor the right of others.
This document contains information of a proprietary nature. None of this information shall be
divulged to persons other than OmniVision Technologies, Inc. employee authorized by the nature of
their duties to receive such information, or individuals or organizations authorized by OmniVision
Technologies, Inc.
1 Company Confidential
Confidential For Actions Only
OV5640 Camera Module Software Application Notes
Table of Contents
OV5640 Camera Module.....................................................................................................................1
Software Application Notes.................................................................................................................1
1. How to Select Output format?.....................................................................................................5
1.1 Back-end with full ISP..........................................................................................................5
1.2 Back-end with YCbCr ISP....................................................................................................6
1.3 Back-end without ISP...........................................................................................................6
1.4 Equations to Convert from One Format to Another.............................................................6
2. How to Select Output Resolution?...............................................................................................7
2.1 back-end with ISP.................................................................................................................7
2.2 back-end without ISP............................................................................................................7
3. How to Adjust frame rate.............................................................................................................7
4. How to set Night Mode Preview.................................................................................................7
4.1 Night Mode VGA Preview with Fixed Frame Rate..............................................................7
4.2 Night Mode VGA preview with Auto Frame Rate...............................................................8
5. How to Remove Light Band in Preview Mode............................................................................9
5.1 Light Band.............................................................................................................................9
5.2 Remove Light band...............................................................................................................9
5.3 Select Banding Filter by Region Information.......................................................................9
5.4 Select Banding Filter by Automatic Light Frequency Detection........................................10
5.5 Remove Light Band In Capture..........................................................................................10
5.6 When Light Band can not be Removed..............................................................................10
6. White Balance............................................................................................................................11
6.1 Simple White Balance.........................................................................................................11
6.2 Advanced White Balance....................................................................................................11
6.3 How to select?.....................................................................................................................11
7. Defect Pixel Correction.............................................................................................................12
8. BLC............................................................................................................................................12
9. Video Mode...............................................................................................................................12
10. Digital zoom............................................................................................................................12
11. OV5640 Functions...................................................................................................................12
11.1 Light Mode........................................................................................................................12
11.2 Color Saturation................................................................................................................14
11.3 Brightness..........................................................................................................................17
11.4 Contrast.............................................................................................................................19
11.5 Hue....................................................................................................................................21
11.6 Special effects...................................................................................................................24
11.7 Exposure level...................................................................................................................26
11.8 Sharpness..........................................................................................................................29
11.9 Mirror/Flip........................................................................................................................30
11.10 YUV Sequence................................................................................................................31
11.11 Clock Polarity.................................................................................................................31
11.12 Compress quality.............................................................................................................32
11.13 Test Pattern.....................................................................................................................32
12. Deal with Lens.........................................................................................................................33
12.1 Light fall off......................................................................................................................33
12.2 Dark corner.......................................................................................................................33
2 Company Confidential
Confidential For Actions Only
OV5640 Camera Module Software Application Notes
12.3 Resolution.........................................................................................................................33
12.4 Optical contrast.................................................................................................................33
12.5 Lens Cover........................................................................................................................33
13. Reference Settings...................................................................................................................34
13.1 YCbCr Reference Setting..................................................................................................34
13.1.1 VGA Preview............................................................................................................34
13.1.2 Other size preview....................................................................................................42
13.1.3 VGA 90fps video.......................................................................................................44
13.1.4 QSXGA Capture......................................................................................................52
13.1.4.1 YUV mode capture............................................................................................52
13.1.4.2 Jpg mode capture...............................................................................................53
13.1.5 Other Capture size DCW from QSXGA ................................................................54
13.1.6 Return to yuv mode..................................................................................................57
13.1.6.1 From 5M YUV to vga YUV..............................................................................57
13.1.6.2 From 5M Jpg to vga yuv....................................................................................59
13.1.7 YUV and JPEG mode change setting.......................................................................60
13.1.7.1 YUV to JPEG setting.........................................................................................60
13.1.7.2 JPEG to YUV setting.........................................................................................60
13.1.8 Zoom function...........................................................................................................60
13.2 Sensor Raw setting............................................................................................................64
13. 3 High Resolution Video....................................................................................................66
13.3.1 1080 P........................................................................................................................66
13.3.2 720 P..........................................................................................................................71
13. 4 Mipi setting......................................................................................................................76
13.4.1 VGA yuv_mipi_2lane_15fps ...................................................................................76
13.4.2 VGA yuv_mipi_2lane_15fps to 5M yuv_mipi_2lane_15fps....................................81
13.4.3 5M jpg_mipi_2lane_15fps.......................................................................................82
14. Capture Sequence....................................................................................................................86
14.1 Shutter...............................................................................................................................86
14. 2 Dummy Lines...................................................................................................................86
14. 3 Dummy Pixels..................................................................................................................86
14.4 Gain...................................................................................................................................86
14.5 Banding Filter...................................................................................................................86
14.5.1 Preview......................................................................................................................86
14.5.2 Capture......................................................................................................................86
14.6 Auto frame rate.................................................................................................................87
14.7 Capture Sequence..............................................................................................................87
14.7.1 Preview......................................................................................................................87
14.7.2 Stop AEC/AGC........................................................................................................87
14.7.3 Single Focus for AF Module.....................................................................................87
14.7.4 Read preview register Value.....................................................................................87
14.7.5 Change resolution to QSXGA...................................................................................87
14.7.6 Read capture register Value......................................................................................87
14.7.7 Calculate Capture Exposure from preview..............................................................87
14.7.8 Calculate the banding filter value..............................................................................87
14.7.9 Redistribute Exposure/Gain with target brightness unchanged................................88
14.7.10 write back the gain/exposure value.........................................................................88
14.7.11 Capture....................................................................................................................88
3 Company Confidential
Confidential For Actions Only
OV5640 Camera Module Software Application Notes
14.7.12 Send finish command for AF module.....................................................................88
14.7.13 Back to preview.......................................................................................................88
14.8 Capture reference code......................................................................................................88
15. Strobe Flash Control................................................................................................................91
16. Auto Focus Application Solution ........................................................................................93
16.1 Embedded Resources........................................................................................................93
16.2 Embedded Auto Focus Solution ......................................................................................93
16.3 General Auto Focus Control Flow...................................................................................93
16.4 How to use Embedded Auto Focus Solution..................................................................93
17. Frame exposure mode ............................................................................................................94
17.1 Introduction.......................................................................................................................94
17.2 FREX function mode........................................................................................................94
17.2.1 Pad mode...................................................................................................................94
17.2.2 I2c mode...................................................................................................................95
17.3 System settings..................................................................................................................96
17.3.1 Pad mode...................................................................................................................96
17.3.2 I2c mode ..................................................................................................................96
17.4 Option settings..................................................................................................................96
17.4.1 Exposure Time (unit: Tline).....................................................................................96
17.4.2 Frame Delay (unit: Tframe), 3b06[7:4] default: 0...................................................96
17.4.3 Flash Strobe Width (unit: Tline), 3b06[3:0] default: 4...........................................96
17.4.4 Frex Shutter Signal Reverse, 3b07[2] default: 0.....................................................96
17.4.5 Frex Mode, 3b07[1:0] default: 0.............................................................................97
17.4.6 Frex Precharge Time(ftx, frst width), 3817[2:0] default: 4.....................................97
17.4.7 VSYNC ends time,...................................................................................................97
18. Some photos captured by 5640 ...............................................................................................97
4 Company Confidential
Confidential For Actions Only
NOTE: OV5640 use 16bits Register address and 8bits Register data.
1. How to Select Output format?
OV5640 support 5 output format: YcbCr422/420, RGB565/555/444, Bayer raw RGB, CCIR656,
YUV422 JPEG. How to choose the right output format for camera phone design or other
applications? Let's look at the back-end chip first.
The general diagram of back-end chip is as below:
The data format at LCD driver are always RGB. For example, RGB444, RGB565, RGB555,
RGB888 etc. The data format and memory interface are always JPEG. The JPEG data is
compressed from YCbCr data. So Both RGB and YCbCr data are needed inside the back-end chip.
The “X” block is different for different back-end chips.
1.1 Back-end with full ISP
This kind of back-end has full ISP. It takes raw RGB input, doing interpolation to generate
RGB24 and doing translation to generate YCbCr. This kind of back-end could take Bayer raw RGB
or processed raw RGB.
The advantage of CIP RAW over sensor Bayer raw RGB is the output data are processed. Sensor
functions such as defect pixel correction, lens correction, gamma, color matrix, de-noise, sharpness,
BLC ,defect pixel correction etc. could be applied. Since the life time of back-end chip is longer
than image sensor, sometimes back-end chips could not fix defects of new sensors if taken Bayer
raw RGB.
If back-end take Bayer raw RGB format from sensor, all the image process operations such as
defect pixel correction, lens correction, gamma, color matrix, de-noise, sharpness, BCL etc should
be done by back-end. If back-end take processed raw RGB format from sensor, the image process
Camera Interface
LCD Driver
Memory Interface
YCbCr
RGB
Bayer raw RGB
Processed raw RGB
Compression Mode
JPEG
RGB
X
Confidential For Actions Only
- 1
- 2
- 3
- 4
- 5
- 6
前往页