LogoVisionLog

Automatic Focus Detection

Advanced 3-metric ensemble algorithm for evaluating facial image sharpness and blur.

Automatic Focus Detection evaluates the sharpness of an uploaded face image using a multi-metric ensemble approach instead of a single gradient measure. This ensures high accuracy and consistency across different lighting conditions, distances, and blur types (defocus vs. motion blur).

Algorithm Overview

The system uses a 3-metric ensemble, resulting in a final score between 0–100 (where higher means sharper).

MetricWeightWhat it detects
Tenengrad (Sobel gradient energy)60%General sharpness, resolution-independent
Crête blur score30%Content-independent perceptual blur
FFT high-frequency ratio10%Motion/directional blur invisible to gradient methods

Classification

The final focus_quality_score (0–100) is translated into five human-readable categories:

  • ≥ 75: sharp
  • ≥ 55: acceptable
  • ≥ 35: slightly_blurry
  • ≥ 15: blurry
  • < 15: very_blurry

Facial Context Application

During detection, the Tenengrad gradient evaluation specifically weights pixel values nearest to the eye landmarks 1.5× higher than other areas. This ensures the biometric pipeline receives photos where the eyes—which are crucial for precise InsightFace embedding extraction—are heavily in focus.

On this page