Class SharpenOp
java.lang.Object
cloud.opencode.base.image.filter.SharpenOp
Unsharp Mask Sharpening Filter
非锐化掩模锐化滤波器
Enhances image edges using unsharp masking: result = src + amount * (src - blur).
The blur is computed via GaussianBlurOp with a configurable sigma.
使用非锐化掩模增强图像边缘:result = src + amount * (src - blur)。
模糊通过 GaussianBlurOp 以可配置的 sigma 计算。
Features | 主要功能:
- Unsharp mask sharpening with configurable amount and sigma - 可配置强度和 sigma 的非锐化掩模锐化
- Default parameters: amount=1.0, sigma=1.0 - 默认参数:amount=1.0, sigma=1.0
- Per-channel processing with clamping to [0, 255] - 逐通道处理并钳制到 [0, 255]
- Alpha channel preservation - Alpha 通道保持不变
Usage Examples | 使用示例:
// Default sharpening (amount=1.0, sigma=1.0)
Raster sharpened = SharpenOp.apply(raster);
// Custom amount
Raster sharpened = SharpenOp.apply(raster, 1.5);
// Custom amount and sigma
Raster sharpened = SharpenOp.apply(raster, 2.0, 2.0);
Performance | 性能特性:
- Time: O(w * h * k) dominated by Gaussian blur - 时间: O(w * h * k) 由高斯模糊主导
- Space: O(w * h) - 空间: O(w * h)
Security | 安全性:
- Thread-safe: Yes (stateless) - 线程安全: 是(无状态)
- Since:
- JDK 25, opencode-base-image V2.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic RasterApply unsharp mask sharpening to aRasterwith default parameters (amount=1.0, sigma=1.0).static RasterApply unsharp mask sharpening to aRasterwith custom amount.static RasterApply unsharp mask sharpening to aRasterwith custom amount and sigma.
-
Method Details
-
apply
-
apply
- Parameters:
raster- the source raster | 源 rasteramount- the sharpening amount (must be >= 0) | 锐化强度(必须 >= 0)- Returns:
- the sharpened raster | 锐化后的 raster
- Since:
- opencode-base-image V1.0.4
-
apply
Apply unsharp mask sharpening to aRasterwith custom amount and sigma. Output format isRGBA_8when the source has alpha, otherwiseRGB_8. 使用自定义强度和 sigma 对Raster应用非锐化掩模锐化。 源含 alpha 时输出RGBA_8,否则RGB_8。- Parameters:
raster- the source raster | 源 rasteramount- the sharpening amount (must be >= 0) | 锐化强度(必须 >= 0)sigma- the Gaussian blur sigma (must be > 0) | 高斯模糊 sigma(必须大于 0)- Returns:
- the sharpened raster | 锐化后的 raster
- Throws:
ImageOperationException- if parameters are invalid | 参数无效时抛出- Since:
- opencode-base-image V1.0.4
-