OV7725 Camera Module Software Application Notes
OV7725 Camera Module Software Application Notes
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
OV7725 Camera Module Software Application Notes
Table of Contents
OV7725 Camera Module..................................................................................................................... 1
Software Application Note................................................................................................................... 1
1. Select Output format....................................................................................................................4
1.1 Backend with full ISP........................................................................................................... 4
1.2 Backend with YCbCr ISP..................................................................................................... 5
1.3 Backend without ISP.............................................................................................................5
1.4 Equations to Convert from One Format to Another............................................................. 5
2. Select Output Resolution............................................................................................................. 6
2.1 Backend with ISP..................................................................................................................6
2.2 Backend without ISP.............................................................................................................6
3. Adjust frame rate......................................................................................................................... 6
3.1 Frame Rate Adjustment for 24Mhz input clock....................................................................6
30 fps, PCLK = 24Mhz.......................................................................................................... 6
15 fps, PCLK = 12Mhz.......................................................................................................... 7
25fps, PCLK = 24Mhz........................................................................................................... 7
14.3fps, PCLK = 12Mhz........................................................................................................ 7
3.2 Frame Rate Adjustment for 26 Mhz input clock...................................................................7
30 fps, PCLK = 26Mhz.......................................................................................................... 7
15 fps, PCLK = 13Mhz.......................................................................................................... 8
25fps, PCLK = 26Mhz........................................................................................................... 8
14.3fps, PCLK = 13Mhz........................................................................................................ 8
3.3 Frame rate adjustment for 13 Mhz input clock..................................................................... 9
30 fps, PCLK = 26Mhz.......................................................................................................... 9
15 fps, PCLK = 13Mhz.......................................................................................................... 9
25fps, PCLK = 26Mhz........................................................................................................... 9
14.3fps, PCLK = 13Mhz........................................................................................................ 9
4. Night Mode................................................................................................................................ 10
4.1 Night Mode with Fixed Frame Rate................................................................................... 10
For 24Mhz/26Mhz Clock Input............................................................................................10
For 13Mhz Clock Input........................................................................................................ 10
4.2 Night Mode with Auto Frame Rate.....................................................................................10
For 24Mhz/26Mhz Clock Input............................................................................................10
For 13Mhz Clock Input........................................................................................................ 11
5. Remove Light Band................................................................................................................... 12
5.1 Light Band...........................................................................................................................12
5.2 Remove Light band............................................................................................................. 12
5.3 Select Banding Filter by Region Information..................................................................... 12
Banding Filter Setting for 24Mhz Input Clock.................................................................... 13
5.4 When Light Band can not be Removed.............................................................................. 14
6. White Balance............................................................................................................................14
6.1 Simple White Balance.........................................................................................................14
6.2 Advanced White Balance....................................................................................................14
6.3 How to select?..................................................................................................................... 15
7. Defect Pixel Correction............................................................................................................. 15
2 Company Confidential
OV7725 Camera Module Software Application Notes
8. BLC............................................................................................................................................15
9. Video Mode............................................................................................................................... 15
10. Digital zoom............................................................................................................................ 16
11. OV7725 Functions...................................................................................................................16
11.1 Light Mode........................................................................................................................16
11.2 Color Saturation................................................................................................................ 17
11.3 Brightness..........................................................................................................................18
11.4 Contrast............................................................................................................................. 19
11.5 Special effects................................................................................................................... 20
12. Deal with Lens......................................................................................................................... 21
12.1 Light fall off...................................................................................................................... 21
12.2 Dark corner....................................................................................................................... 21
12.3 Resolution......................................................................................................................... 21
12.4 Optical contrast................................................................................................................. 21
12.5 Lens Cover........................................................................................................................ 22
12.6 Lens Correction.................................................................................................................22
13. Reference Settings................................................................................................................... 22
13.1 YCbCr............................................................................................................................... 22
13.2 RGB raw........................................................................................................................... 24
13.3 RGB565............................................................................................................................ 24
3 Company Confidential
OV7725 Camera Module Software Application Notes
OV7725 support 4 output formats: YCbCr, RGB565/RGB555, Bayer raw RGB and Processed raw
RGB. How to choose the right output format for camera phone design or other applications? Let's
look at the backend chip first.
YCbCr X RGB
RGB
Bayer raw RGB
Processed raw RGB
The data format at LCD driver are always RGB. For example, RGB444, RGB565, RGB555,
RGB888 etc. The data format and memory interface are always Compressed. The Compression data
is compressed from YCbCr data. So Both RGB and YCbCr data are needed inside the backend
chip. The “X” block is different for different backend chips.
This kind of backend has full ISP. It takes raw RGB input, doing interpolation to generate
RGB24 and doing translation to generate YCbCr. This kind of backend could take either Bayer raw
RGB or processed raw RGB.
The advantage of processed raw RGB over 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 etc. could be applied. Since the life time of backend chip is longer than image
sensor, sometimes backend chips could not fix defects of new sensors if taken Bayer raw RGB. But
the defects of new sensors could be fixed in processed raw RGB output.
If backend 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 backend. If backend take processed raw RGB format from sensor, the image process
operations such as defect pixel correction, lens correction, gamma, color matrix, de-noise,
4 Company Confidential
OV7725 Camera Module Software Application Notes
sharpness, BCL etc could be done either inside sensor or by backend chips. In other words, user
could select the image process operation be done by which side.
This kind of backend has ISP, but could take only YCbCr format. The ISP could convert YCbCr
to RGB format for LCD display and compress YCbCr for storage.
This kind of backend doesn't have ISP built-in. It can not convert from one format to another by
hardware. Actually the format conversion is done by software. There are 3 possible solution for this
kind of backend chips.
a. Sensor output YCbCr. Backend convert YCbCr to RGB for display by software.
b. Sensor output RGB565. Backend convert RGB565 to YCbCR for compression.
c. Sensor output RGB565 for preview, output YCbCr for capture ( compression).
Solution a. provide the best picture quality. Since the input data is 24-bit RGB equivalent. It
could converted to RGB888 for LCD display. Solution b. provide the worst picture quality. Since
the input data is only 16-bit RGB565, even it is converted to YCbCr, the color depth is still 16-bit.
The solution c. provide similar picture quality as solution a. But since preview is RGB565, capture
is YCbCr, preview picture may looks a little different than capture picture.
RGB24 to YCbCr
R = Y + 1.371(Cr – 128)
G = Y – 0.698(Cr – 128) – 0.336(Cb – 128)
B = Y + 1.732(Cb – 128)
5 Company Confidential
OV7725 Camera Module Software Application Notes
6 Company Confidential
OV7725 Camera Module Software Application Notes
7 Company Confidential
OV7725 Camera Module Software Application Notes
write_SCCB(0x2b, 0x00);
write_SCCB(0x33, 0x2b);
write_SCCB(0x34, 0x00);
write_SCCB(0x2d, 0x00);
write_SCCB(0x2e, 0x00);
write_SCCB(0x0e, 0x65);
8 Company Confidential
OV7725 Camera Module Software Application Notes
9 Company Confidential
OV7725 Camera Module Software Application Notes
write_SCCB(0x2b, 0x00);
write_SCCB(0x33, 0x46);
write_SCCB(0x34, 0x00);
write_SCCB(0x2d, 0x00);
write_SCCB(0x2e, 0x00);
write_SCCB(0x0e, 0x65);
4. Night Mode
There are 2 types of settings for night mode. One type is set to fixed low frame rate, for example
3.75fps. The other type is set to auto frame rate, for example from 30fps to 3.75fps. When
environment is bright, the frame rate is increased to 30fps. When environment is dark, the frame
rate is decreased to 3.65fps.
10 Company Confidential
OV7725 Camera Module Software Application Notes
write_SCCB(0x11, 0x01);
write_SCCB(0x0e, 0xf5);
Note:
When OV7725 is set to low frame rate, there may be many white pixels shown on LCD of
mobile phone or on PC diaplay.
11 Company Confidential
OV7725 Camera Module Software Application Notes
AC
Light
Exposure
Not n/100, has band = n/100, no band
The strength of office light is not even. It changes with AC frequency. For example, if the AC
frequency is 50Hz, the light changes strength at 100hz.
Different frame rate could be used for different light frequency. So the frame rate is optimized for
12 Company Confidential
OV7725 Camera Module Software Application Notes
13 Company Confidential
OV7725 Camera Module Software Application Notes
SCCB_salve_Address = 0x42;
write_SCCB(0x13, 0xff); //banding filter enable
write_SCCB(0x22, 0x52); //50Hz banding filter
write_SCCB(0x23, 0x06); //7 step for 50hz
But there is some special conditions such as mix light of sun light and office light, take picture of
florescent light, the light band can not removed. The reason is the exposure time is less than 1/100
second for 50hz light environment and less than 1/120 second for 60hz light environment, so the
light band can not be removed.
The light band is this conditions could not be removed for all CMOS sensors, not only OV7725.
So there is no way to remove light band in this condition.
6. White Balance
OV7725 support simple white balance and advanced balance.
Settings
SCCB_salve_Address = 0x42;
write_SCCB(0x13, 0xff); //AWB on
write_SCCB(0x69, 0x5d); // Simple AWB
14 Company Confidential
OV7725 Camera Module Software Application Notes
Settings
Contact with OmniVision local FAE.
Dead pixel include white dead pixel and black dead pixel. White dead pixel is always white no
matter the actual picture is bright or dark. Black dead pixel is always black no matter the actual
picture is bright or dark.
Wounded pixel may change with light, but not as much as normal pixel. White wounded pixels
are much brighter then normal pixels, but not complete white. Black wounded pixels are much
darker than normal pixels, but not complete black.
OV7725 has built-in defect pixel correction function. If OV7725 output YCbCr, RGB565,
Processed raw RGB, the defect pixel correction function could be enabled to fix defect pixels. But if
Bayer raw RGB is used, the defect pixel correction function of sensor could not be used. The defect
pixel correction of backend chip should be used instead.
Please pay attention to the defect pixel correction function of backend chip. Some backend chip
may not be able to correct all defect pixels of OV7725.
8. BLC
The function of Black Level Calibration (BLC) is to product accurate color in the dark area of
picture. There is automatic BLC function built-in OV7725. It should always be turned on.
9. Video Mode
Video mode need high frame rate, usually fixed 15fps. There is no night mode for video mode.
15 Company Confidential
OV7725 Camera Module Software Application Notes
If backend chip support scale up, then more zoom level could be supported.
Sunny
SCCB_salve_Address = 0x42;
write_SCCB(0x13, 0xfd); //AWB off
write_SCCB(0x01, 0x5a);
write_SCCB(0x02, 0x5c);
write_SCCB(0x0e, 0x65);
write_SCCB(0x2d, 0x00);
write_SCCB(0x2e, 0x00);
Cloudy
SCCB_salve_Address = 0x42;
write_SCCB(0x13, 0xfd); //AWB off
write_SCCB(0x01, 0x58);
write_SCCB(0x02, 0x60);
write_SCCB(0x0e, 0x65);
write_SCCB(0x2d, 0x00);
write_SCCB(0x2e, 0x00);
Office
SCCB_salve_Address = 0x42;
write_SCCB(0x13, 0xfd); //AWB off
write_SCCB(0x01, 0x84);
write_SCCB(0x02, 0x4c);
write_SCCB(0x0e, 0x65);
write_SCCB(0x2d, 0x00);
16 Company Confidential
OV7725 Camera Module Software Application Notes
write_SCCB(0x2e, 0x00);
Home
SCCB_salve_Address = 0x42;
write_SCCB(0x13, 0xfd); //AWB off
write_SCCB(0x01, 0x96);
write_SCCB(0x02, 0x40);
write_SCCB(0x0e, 0x65);
write_SCCB(0x2d, 0x00);
write_SCCB(0x2e, 0x00);
Night
SCCB_salve_Address = 0x42;
write_SCCB(0x13, 0xff); //AWB on
write_SCCB(0x0e, 0xe5);
The color saturation of OV7725 could be adjusted. High color saturation would make the picture
looks more vivid, but the side effect is the bigger noise and not accurate skin color.
Saturation + 4
SCCB_salve_Address = 0x42;
write_SCCB(0xa7, 0x80);
write_SCCB(0xa8, 0x80);
Saturation + 3
SCCB_salve_Address = 0x42;
write_SCCB(0xa7, 0x70);
write_SCCB(0xa8, 0x70);
Saturation + 2
SCCB_salve_Address = 0x42;
write_SCCB(0xa7, 0x60);
write_SCCB(0xa8, 0x60);
Saturation + 1
SCCB_salve_Address = 0x42;
write_SCCB(0xa7, 0x50);
write_SCCB(0xa8, 0x50);
Saturation 0
SCCB_salve_Address = 0x42;
write_SCCB(0xa7, 0x40);
write_SCCB(0xa8, 0x40);
17 Company Confidential
OV7725 Camera Module Software Application Notes
Saturation -1
SCCB_salve_Address = 0x42;
write_SCCB(0xa7, 0x30);
write_SCCB(0xa8, 0x30);
Saturation - 2
SCCB_salve_Address = 0x42;
write_SCCB(0xa7, 0x20);
write_SCCB(0xa8, 0x20);
Saturation - 3
SCCB_salve_Address = 0x42;
write_SCCB(0xa7, 0x10);
write_SCCB(0xa8, 0x10);
Saturation - 4
SCCB_salve_Address = 0x42;
write_SCCB(0xa7, 0x00);
write_SCCB(0xa8, 0x00);
11.3 Brightness
The brightness of OV7725 could be adjusted. Higher brightness will make the picture more
bright. The side effect of higher brightness is the picture looks frogy.
Brightness +4
SCCB_salve_Address = 0x42;
write_SCCB(0x9b, 0x48);
write_SCCB(0xab, 0x06);
Brightness +3
SCCB_salve_Address = 0x42;
write_SCCB(0x9b, 0x38);
write_SCCB(0xab, 0x06);
Brightness +2
SCCB_salve_Address = 0x42;
write_SCCB(0x9b, 0x28);
write_SCCB(0xab, 0x06);
Brightness +1
SCCB_salve_Address = 0x42;
write_SCCB(0x9b, 0x18);
write_SCCB(0xab, 0x06);
Brightness 0
SCCB_salve_Address = 0x42;
18 Company Confidential
OV7725 Camera Module Software Application Notes
write_SCCB(0x9b, 0x08);
write_SCCB(0xab, 0x06);
Brightness -1
SCCB_salve_Address = 0x42;
write_SCCB(0x9b, 0x08);
write_SCCB(0xab, 0x0e);
Brightness -2
SCCB_salve_Address = 0x42;
write_SCCB(0x9b, 0x18);
write_SCCB(0xab, 0x0e);
Brightness -3
SCCB_salve_Address = 0x42;
write_SCCB(0x9b, 0x28);
write_SCCB(0xab, 0x0e);
Brightness -4
SCCB_salve_Address = 0x42;
write_SCCB(0x9b, 0x38);
write_SCCB(0xab, 0x0e);
11.4 Contrast
The contrast of OV7725 could be adjusted. Higher contrast will make the picture sharp. But the
side effect is loosing dynamic range.
Contrast +4
SCCB_salve_Address = 0x42;
write_SCCB(0x9c, 0x30);
Contrast +3
SCCB_salve_Address = 0x42;
write_SCCB(0x9c, 0x2c);
Contrast +2
SCCB_salve_Address = 0x42;
write_SCCB(0x9c, 0x28);
Contrast +1
SCCB_salve_Address = 0x42;
write_SCCB(0x9c, 0x24);
Contrast 0
SCCB_salve_Address = 0x42;
19 Company Confidential
OV7725 Camera Module Software Application Notes
write_SCCB(0x9c, 0x20);
Contrast -1
SCCB_salve_Address = 0x42;
write_SCCB(0x9c, 0x1c);
Contrast -2
SCCB_salve_Address = 0x42;
write_SCCB(0x9c, 0x18);
Contrast -3
SCCB_salve_Address = 0x42;
write_SCCB(0x9c, 0x14);
Contrast -4
SCCB_salve_Address = 0x42;
write_SCCB(0x9c, 0x10);
Normal
SCCB_salve_Address = 0x42;
write_SCCB(0xa6, 0x06);
write_SCCB(0x60, 0x80);
write_SCCB(0x61, 0x80);
B&W
SCCB_salve_Address = 0x42;
write_SCCB(0xa6, 0x26);
write_SCCB(0x60, 0x80);
write_SCCB(0x61, 0x80);
Bluish
SCCB_salve_Address = 0x42;
write_SCCB(0xa6, 0x1e);
write_SCCB(0x60, 0xa0);
write_SCCB(0x61, 0x40);
Sepia
SCCB_salve_Address = 0x42;
write_SCCB(0xa6, 0x1e);
write_SCCB(0x60, 0x40);
write_SCCB(0x61, 0xa0);
20 Company Confidential
OV7725 Camera Module Software Application Notes
Redish
SCCB_salve_Address = 0x42;
write_SCCB(0xa6, 0x1e);
write_SCCB(0x60, 0x80);
write_SCCB(0x61, 0xc0);
Greenish
SCCB_salve_Address = 0x42;
write_SCCB(0xa6, 0x1e);
write_SCCB(0x60, 0x60);
write_SCCB(0x61, 0x60);
Negative
SCCB_salve_Address = 0x42;
write_SCCB(0xa6, 0x46);
12.3 Resolution
The resolution of camera module depends on lens design, focus adjustment and sensor resolution
as well. The focus adjustment is very important for camera module assembly.
For OV7725 the focus distance is about 50~60cm. The depth of field is about from 25~30cm to
infinite. If checking resolution of camera module, the resolution chart should be placed 50~60 cm
away.
21 Company Confidential
OV7725 Camera Module Software Application Notes
13.1 YCbCr
//OV7720, YCbCr, VGA
//15fps at 24MHz input clock, 4x maximum gain
//2/27/2007
Delay(2ms);
write_SCCB(0x3d, 0x03);
write_SCCB(0x17, 0x22);
write_SCCB(0x18, 0xa4);
write_SCCB(0x19, 0x07);
write_SCCB(0x1a, 0xf0);
write_SCCB(0x32, 0x00);
write_SCCB(0x29, 0xa0);
write_SCCB(0x2c, 0xf0);
write_SCCB(0x2a, 0x00);
write_SCCB(0x11, 0x01);
write_SCCB(0x42, 0x7f);
write_SCCB(0x4d, 0x09);
write_SCCB(0x63, 0xe0);
write_SCCB(0x64, 0xff);
write_SCCB(0x65, 0x20);
write_SCCB(0x66, 0x00);
write_SCCB(0x67, 0x48);
write_SCCB(0x13, 0xf0);
write_SCCB(0x0d, 0x41); // 0x51/0x61/0x71 for different AEC/AGC window
write_SCCB(0x0f, 0xc5);
write_SCCB(0x14, 0x11);
write_SCCB(0x22, 0x7f);
write_SCCB(0x23, 0x03);
write_SCCB(0x24, 0x40);
22 Company Confidential
OV7725 Camera Module Software Application Notes
write_SCCB(0x25, 0x30);
write_SCCB(0x26, 0xa1);
write_SCCB(0x2b, 0x00);
write_SCCB(0x6b, 0xaa);
write_SCCB(0x13, 0xff);
write_SCCB(0x90, 0x05);
write_SCCB(0x91, 0x01);
write_SCCB(0x92, 0x03);
write_SCCB(0x93, 0x00);
write_SCCB(0x94, 0xb0);
write_SCCB(0x95, 0x9d);
write_SCCB(0x96, 0x13);
write_SCCB(0x97, 0x16);
write_SCCB(0x98, 0x7b);
write_SCCB(0x99, 0x91);
write_SCCB(0x9a, 0x1e);
write_SCCB(0x9b, 0x08);
write_SCCB(0x9c, 0x20);
write_SCCB(0x9e, 0x81);
write_SCCB(0xa6, 0x06);
//Gamma
write_SCCB(0x7e, 0x0c);
write_SCCB(0x7f, 0x16);
write_SCCB(0x80, 0x2a);
write_SCCB(0x81, 0x4e);
write_SCCB(0x82, 0x61);
write_SCCB(0x83, 0x6f);
write_SCCB(0x84, 0x7b);
write_SCCB(0x85, 0x86);
write_SCCB(0x86, 0x8e);
write_SCCB(0x87, 0x97);
write_SCCB(0x88, 0xa4);
write_SCCB(0x89, 0xaf);
write_SCCB(0x8a, 0xc5);
write_SCCB(0x8b, 0xd7);
write_SCCB(0x8c, 0xe8);
write_SCCB(0x8d, 0x20);
23 Company Confidential
OV7725 Camera Module Software Application Notes
//write_SCCB(0x23, 0x03);
write_SCCB(0x0e, 0x65);
13.3 RGB565
Contact OmniVision local FAE
24 Company Confidential