Class HistogramEqualizationOp

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

public final class HistogramEqualizationOp extends Object
Histogram Equalization Operations 直方图均衡化操作工具类

Provides histogram equalization for grayscale and color images. Grayscale equalization uses a CDF-based lookup table; color equalization converts to HSV and equalizes only the V (value/brightness) channel.

提供灰度图像和彩色图像的直方图均衡化。 灰度均衡化使用基于 CDF 的查找表;彩色均衡化转换为 HSV 并仅均衡 V(亮度)通道。

Features | 主要功能:

  • Grayscale histogram equalization via LUT - 通过查找表实现灰度直方图均衡化
  • Color histogram equalization via HSV V-channel - 通过 HSV V 通道实现彩色直方图均衡化

Usage Examples | 使用示例:

Raster equalized = HistogramEqualizationOp.apply(rasterGray);

Performance | 性能特性:

  • Time complexity: O(w * h) - 时间复杂度: O(w * h)
  • Space complexity: O(w * h) for output image - 空间复杂度: O(w * h) 输出图像

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 grayscale histogram equalization to a Raster. 对 Raster 应用灰度直方图均衡化。

      Computes a CDF-based LUT and writes a PixelFormat.GRAY_8 output.

      计算基于 CDF 的查找表,输出 PixelFormat.GRAY_8 结果。

      Parameters:
      raster - the source raster | 源 raster
      Returns:
      the equalized GRAY_8 raster | 均衡化后的 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 grayscale histogram equalization to a Raster with optional output buffer. 对 Raster 应用灰度直方图均衡化,可指定输出缓冲。
      Parameters:
      raster - the source raster | 源 raster
      dst - optional output GRAY_8 raster; may be null | 可选 GRAY_8 输出 raster,可为 null
      Returns:
      the equalized GRAY_8 raster | 均衡化后的 GRAY_8 raster
      Throws:
      NullPointerException - if raster is null | 当 raster 为 null 时抛出
      Since:
      opencode-base-image V1.0.4