3A Algorithms in Digital Cameras

1 minute read

1. Autofocus(AF) algorithms

Camera’s autofocus automatically adjusts the distance between the camera lens and the CCD through the camera’s internal micro-driving motor to ensure that the image plane is projected onto the CCD’s image surface.

  • Algorithms and formulas are based on perceptions of the human eyes, which are more sensitive to brightness/luminance compared to chrominance
  • Y value in the colorspace of both YUV and YCrCb indicates the luminance

a. Contrast Detection AutoFocus (CDAF)

  • measures the contrast at different lens positions
  • find the maximum contrast.
  • the contrast is defined as the degree of sharpness within an image

Image clarity evaluation methods

The complexity of the autofocus algorithm depends on the method to define the contrast, which is different from company to company

1. Canny Edge Detection
2. Tenengrad gradient method (using Sobel operator) 
3. Laplacian gradient method (using Laplace operator) 
4. Variance method 

b. Other algorithms

2. Autoexposure(AE)

General Scheme of Algorithm

Auto exposure is to find an optimal exposure time at a given environment, which is typically made in the following steps.

Step 1: A pre-determined exposure value can be calculated as follow

\begin{equation} EV = \log_2\left(F^2/T \right) = 2\log_2(F) - \log_2(T) \label{eq:EVpre} \end{equation}

  • $EV$: Exposure value
  • F: Aperture size
  • T: exposure time (duration)

Step 2: Convert the RGB values to Brightness $B$
Step 3: Derive a single number $B_{pre}$ from the brightness picture
Step 4: Calculate the optimum exposure $EV_{opt}$

\begin{equation} EV_{opt} = EV_{pre} + \log_2(B_{pre}) + \log_2(B_{opt}) \end{equation}

Mean Value AE (Ref.5)

High Dynamic-Range Histogram(HDH) AE

3. Autowhitebalance(AWB) (Color Balancing)

Human eyes adapt to varying illumination conditions that image sensor can’t, thus this needs to be computed

There are two ways of balancing

  • Pre-computed sets
  • Guess with an algorithm

Algorithms ref

  • Gray World White Balancing Algorithm
  • perfect reflection
  • Dynamic threshold

References

  1. Medium: How the camera Autofocus feature works in Digital smartphone.
  2. Color conversion in OpenCV.
  3. Naver blog.
  4. What is PDAF and how does it work?.
  5. AE: Using Brightness Histogram to perform Optimum Auto Exposure.
  6. AWB: Gray World Algorithm.
  7. AWB: By OpenCV on Stackoverflow

  8. OpenCV autofocus using gradient operators