Class WhiteBalanceOp
java.lang.Object
cloud.opencode.base.image.color.WhiteBalanceOp
Gray World White Balance Operation
灰度世界白平衡操作工具类
Implements the Gray World assumption for automatic white balance correction. Each color channel is scaled so that its mean equals the overall gray mean.
实现灰度世界假设的自动白平衡校正。 将每个颜色通道进行缩放,使其均值等于总体灰度均值。
Features | 主要功能:
- Gray World automatic white balance - 灰度世界自动白平衡
- Per-channel mean normalization - 逐通道均值归一化
Usage Examples | 使用示例:
BufferedImage balanced = WhiteBalanceOp.apply(image);
Performance | 性能特性:
- Time: O(n) where n = pixel count (two passes) - 时间: O(n),n 为像素数量(两次遍历)
- Space: O(n) for output image - 空间: O(n) 用于输出图像
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 Summary
Modifier and TypeMethodDescriptionstatic BufferedImageapply(BufferedImage image) Apply Gray World white balance correction to an image.
-
Method Details
-
apply
Apply Gray World white balance correction to an image. 对图像应用灰度世界白平衡校正。Computes the mean of each RGB channel, then scales each channel so that its mean equals the overall gray mean (average of the three means).
计算每个 RGB 通道的均值,然后缩放每个通道使其均值等于总体灰度均值(三个均值的平均值)。
- Parameters:
image- the source image | 源图像- Returns:
- the white-balanced image | 白平衡校正后的图像
- Throws:
ImageOperationException- if image is null | 当图像为 null 时抛出
-