Principles, implementation and application of the HDR photo Mode

Source: Internet
Author: User

HDR photo:
(High dynamic range imaging) high-dynamic range imaging is a group of technologies used to achieve greater exposure Dynamic Ranges (that is, greater differences between light and shade) than ordinary digital image technology.
The purpose of high dynamic range imaging is to correctly express the brightness of a range from direct sunlight to the shortest shadow in the real world. Today, this is common for digital cameras and mobile phones.

Applicable scenarios:
It is more suitable for use in scenarios with significant dark changes. This prevents overexposure of bright scenes and underexposure of hidden scenes. For example, shooting a person in the backlight environment can clearly picture the person and the environment.
In other words, the details of scenes in the dark are more adequate!

See the following photos:

Figure 1

As shown in figure 1, after HDR is enabled, the trees and walls in the dark are correctly exposed and can be clearly viewed.


Figure 2

Figure 3

For example, if HDR is enabled in step 3, the scenes in the upper left corner and corridor can be brighter. All images are from the network!

Detailed implementation method:

In fact, the current method is to set three sets of EV values to expose the current scene. A photo uses the current hidden light to calculate the normal ev_value exposure, the other two images are respectively exposed with an EVR of 0.5 times and an EVR of 2 times. Finally, the three photos were synthesized according to a certain algorithm. The hidden scenes were partial photos exposed twice as much as EV, while the bright objects were partial photos exposed 0.5 times eV. In this way, the entire photo scenario will not be too bright or too dark.

Code implementation:
This function is available in the XXX \ Alps. jb3.tdd. MP. v2_td_xxx \ mediatek \ custom \ common \ kernel \ imgsensor \ ov5645_mipi_yuv \ ov5645mipiyuv_sensor.c driver file.
BOOL OV5645MIPI_set_param_exposure_for_HDR(UINT16 para){    kal_uint32 totalGain = 0, exposureTime = 0;OV5645MIPISENSORDB("[OV5645MIPI]enter OV5645MIPI_set_param_exposure_for_HDR function:\n ");OV5645MIPISENSORDB("[OV5645MIPI]enter para=%d,manualAEStart%d\n",para,OV5645MIPISensor.manualAEStart);    if (0 == OV5645MIPISensor.manualAEStart)    {               OV5645MIPI_set_AE_mode(KAL_FALSE);//Manual AE enable        spin_lock(&ov5645mipi_drv_lock);        OV5645MIPISensor.manualAEStart = 1;spin_unlock(&ov5645mipi_drv_lock);    }totalGain = OV5645MIPISensor.currentAxDGain;    exposureTime = OV5645MIPISensor.currentExposureTime;switch (para){   case AE_EV_COMP_20://+2 EV       case AE_EV_COMP_10:// +1 EV   totalGain = totalGain<<1;           exposureTime = exposureTime<<1;           OV5645MIPISENSORDB("[4EC] HDR AE_EV_COMP_20\n"); break;   case AE_EV_COMP_00:// +0 EV           OV5645MIPISENSORDB("[4EC] HDR AE_EV_COMP_00\n"); break;   case AE_EV_COMP_n10:  // -1 EV   case AE_EV_COMP_n20:  // -2 EV   totalGain = totalGain >> 1;           exposureTime = exposureTime >> 1;           OV5645MIPISENSORDB("[4EC] HDR AE_EV_COMP_n20\n"); break;   default: break;//return FALSE;}totalGain = (totalGain > OV5645MIPI_MAX_AXD_GAIN) ? OV5645MIPI_MAX_AXD_GAIN : totalGain;    //exposureTime = (exposureTime > OV5645MIPI_MAX_EXPOSURE_TIME) ? OV5645MIPI_MAX_EXPOSURE_TIME : exposureTime;    OV5645MIPIWriteSensorGain(totalGain);OV5645MIPIWriteShutter(exposureTime);OV5645MIPISENSORDB("[OV5645MIPI]exit OV5645MIPI_set_param_exposure_for_HDR function:\n ");return TRUE;}

This function runs three times and runs three cases: AE _ev_comp_00, AE _ev_comp_20, and AE _ev_comp_n20. The three cases are exposed by three groups of totalgain and exposuretime values respectively.
We can see the 0.5, times of the three values.

Exam preparation document:
Note: In this article, the HDR shooting technique is described very well. You can take a look at it if necessary.

Principles, implementation and application of the HDR photo Mode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.