histogram_analysis

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

histogram_analysis

histogram_analysis

El análisis del histograma de luminosidad detecta imágenes con iluminación deficiente que comprometerían la calidad del liveness y face match.
亮度直方图分析可检测出光照不佳的图像,这类图像会降低活体检测和人脸匹配的质量。

When to use

适用场景

Aplicar junto con laplacian_variance en el pipeline de validación de calidad de cada frame.
在每帧图像的质量校验流水线中,与laplacian_variance方法一同使用。

Instructions

使用说明

  1. Convertir a HSV:
    hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
  2. Extraer canal V:
    v_channel = hsv[:,:,2]
  3. Percentiles:
    p5 = np.percentile(v_channel, 5)
    ,
    p95 = np.percentile(v_channel, 95)
  4. Sobreexposición: si >10% píxeles con V>250 →
    OVEREXPOSED
    .
  5. Subexposición: si >10% píxeles con V<20 →
    UNDEREXPOSED
    .
  6. Devolver
    { quality_issues: [], brightness_mean: float, contrast_score: float }
    .
  1. 转换为HSV格式:
    hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
  2. 提取V通道:
    v_channel = hsv[:,:,2]
  3. 计算百分位数:
    p5 = np.percentile(v_channel, 5)
    p95 = np.percentile(v_channel, 95)
  4. 过曝判定:若超过10%的像素V值大于250 →
    OVEREXPOSED
  5. 欠曝判定:若超过10%的像素V值小于20 →
    UNDEREXPOSED
  6. 返回结果:
    { quality_issues: [], brightness_mean: float, contrast_score: float }

Notes

注意事项

  • Proporcionar feedback en tiempo real: "Mejora la iluminación", "Reduce el brillo".
  • Iluminación artificialmente perfecta puede indicar spoofing de pantalla.
  • 提供实时反馈:"请改善光照"、"请降低亮度"。
  • 过于完美的人工光照可能意味着屏幕欺骗攻击。