Class ClaheOp

java.lang.Object
cloud.opencode.base.image.histogram.ClaheOp

public final class ClaheOp extends Object
Contrast Limited Adaptive Histogram Equalization (CLAHE) 对比度限制自适应直方图均衡化 (CLAHE)

CLAHE divides the image into tiles, performs contrast-limited histogram equalization on each tile, and uses bilinear interpolation between tiles to eliminate boundary artifacts.

CLAHE 将图像分割为多个块,对每个块执行对比度限制的直方图均衡化, 并在块之间使用双线性插值消除边界伪影。

Features | 主要功能:

  • Adaptive local contrast enhancement - 自适应局部对比度增强
  • Clip limit prevents noise amplification - 裁剪限制防止噪声放大
  • Bilinear interpolation for smooth transitions - 双线性插值实现平滑过渡
  • Configurable tile grid size and clip limit - 可配置的块网格大小和裁剪限制

Usage Examples | 使用示例:

// Default parameters (clipLimit=2.0, tileGridSize=8)
Raster result = ClaheOp.apply(raster);

// Custom parameters
Raster result2 = ClaheOp.apply(raster, 3.0, 16);

Performance | 性能特性:

  • Time complexity: O(w * h) - 时间复杂度: O(w * h)
  • Space complexity: O(w * h + tileGridSize^2 * 256) - 空间复杂度: O(w * h + tileGridSize^2 * 256)

Security | 安全性:

  • Thread-safe: Yes (stateless) - 线程安全: 是(无状态)
  • Null-safe: No - 空值安全: 否
Since:
JDK 25, opencode-base-image V2.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Details

    • apply

      public static Raster apply(Raster raster)
      Apply CLAHE with default parameters (clipLimit=2.0, tileGridSize=8) to a Raster. 使用默认参数对 Raster 应用 CLAHE。
      Parameters:
      raster - the source raster | 源 raster
      Returns:
      the CLAHE-enhanced GRAY_8 raster | CLAHE 增强后的 GRAY_8 raster
      Throws:
      NullPointerException - if raster is null | 当 raster 为 null 时抛出
      Since:
      opencode-base-image V1.0.4
    • apply

      public static Raster apply(Raster raster, Raster dst)
      Apply CLAHE with default parameters and optional output buffer. 使用默认参数并指定输出缓冲对 Raster 应用 CLAHE。
      Parameters:
      raster - the source raster | 源 raster
      dst - optional output GRAY_8 raster; may be null | 可选 GRAY_8 输出 raster,可为 null
      Returns:
      the CLAHE-enhanced GRAY_8 raster | CLAHE 增强后的 GRAY_8 raster
      Throws:
      NullPointerException - if raster is null | 当 raster 为 null 时抛出
      Since:
      opencode-base-image V1.0.4
    • apply

      public static Raster apply(Raster raster, double clipLimit, int tileGridSize)
      Apply CLAHE with specified parameters to a Raster. 使用指定参数对 Raster 应用 CLAHE。
      Parameters:
      raster - the source raster | 源 raster
      clipLimit - the contrast clip limit (must be positive) | 对比度裁剪限制(必须为正数)
      tileGridSize - the number of tiles in each dimension (must be positive) | 每个维度的块数(必须为正数)
      Returns:
      the CLAHE-enhanced GRAY_8 raster | CLAHE 增强后的 GRAY_8 raster
      Throws:
      NullPointerException - if raster is null | 当 raster 为 null 时抛出
      ImageOperationException - if clipLimit or tileGridSize is invalid | 当参数无效时抛出
      Since:
      opencode-base-image V1.0.4
    • apply

      public static Raster apply(Raster raster, double clipLimit, int tileGridSize, Raster dst)
      Apply CLAHE with specified parameters and optional output buffer to a Raster. 使用指定参数并指定输出缓冲对 Raster 应用 CLAHE。
      Parameters:
      raster - the source raster | 源 raster
      clipLimit - the contrast clip limit (must be positive) | 对比度裁剪限制(必须为正数)
      tileGridSize - the number of tiles in each dimension (must be positive) | 每个维度的块数(必须为正数)
      dst - optional output GRAY_8 raster; may be null | 可选 GRAY_8 输出 raster,可为 null
      Returns:
      the CLAHE-enhanced GRAY_8 raster | CLAHE 增强后的 GRAY_8 raster
      Throws:
      NullPointerException - if raster is null | 当 raster 为 null 时抛出
      ImageOperationException - if clipLimit or tileGridSize is invalid | 当参数无效时抛出
      Since:
      opencode-base-image V1.0.4