3A Algorithms in Digital Cameras

1 minute read

1. Autofocus(AF) algorithmsPermalink

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)Permalink

  • 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 algorithmsPermalink

2. Autoexposure(AE)Permalink

General Scheme of AlgorithmPermalink

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

EV=log2(F2/T)=2log2(F)log2(T)

  • 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 Bpre from the brightness picture
Step 4: Calculate the optimum exposure EVopt

EVopt=EVpre+log2(Bpre)+log2(Bopt)

Mean Value AE (Ref.5)Permalink

High Dynamic-Range Histogram(HDH) AEPermalink

3. Autowhitebalance(AWB) (Color Balancing)Permalink

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 refPermalink

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

ReferencesPermalink

  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