Class GammaOp
java.lang.Object
cloud.opencode.base.image.color.GammaOp
Gamma Correction Operation
伽马校正操作工具类
Applies gamma correction to an image using a pre-computed lookup table for efficient per-pixel transformation.
使用预计算查找表对图像进行伽马校正,实现高效的逐像素变换。
Features | 主要功能:
- Gamma correction via LUT for O(n) performance - 基于 LUT 的伽马校正,O(n) 性能
- Supports arbitrary positive gamma values - 支持任意正伽马值
Usage Examples | 使用示例:
BufferedImage corrected = GammaOp.apply(image, 2.2);
Performance | 性能特性:
- Time: O(n) where n = pixel count - 时间: O(n),n 为像素数量
- LUT creation: O(256) - LUT 创建: O(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 Summary
Modifier and TypeMethodDescriptionstatic BufferedImageapply(BufferedImage image, double gamma) Apply gamma correction to an image.
-
Method Details
-
apply
Apply gamma correction to an image. 对图像应用伽马校正。Gamma > 1.0 darkens the image, gamma < 1.0 brightens it, and gamma = 1.0 leaves the image unchanged.
伽马值 > 1.0 使图像变暗,< 1.0 使图像变亮, 等于 1.0 时图像不变。
- Parameters:
image- the source image | 源图像gamma- the gamma value (must be positive) | 伽马值(必须为正数)- Returns:
- the gamma-corrected image | 伽马校正后的图像
- Throws:
ImageOperationException- if image is null or gamma is not positive | 当图像为 null 或伽马值不为正数时抛出
-