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)
BufferedImage result = ClaheOp.apply(image);

// Custom parameters
BufferedImage result2 = ClaheOp.apply(image, 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 BufferedImage apply(BufferedImage image)
      Apply CLAHE with default parameters (clipLimit=2.0, tileGridSize=8). 使用默认参数(clipLimit=2.0, tileGridSize=8)应用 CLAHE。
      Parameters:
      image - the source image | 源图像
      Returns:
      the CLAHE-enhanced image | CLAHE 增强后的图像
      Throws:
      NullPointerException - if image is null | 当图像为 null 时抛出
    • apply

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