Class LaplacianOp

java.lang.Object
cloud.opencode.base.image.edge.LaplacianOp

public final class LaplacianOp extends Object
Laplacian Edge Detection Operator Laplacian 边缘检测算子

Applies a 3x3 Laplacian kernel to detect edges by computing the second derivative of image intensity. The kernel [0,1,0, 1,-4,1, 0,1,0] responds strongly to rapid intensity changes in all directions.

应用 3x3 Laplacian 卷积核通过计算图像强度的二阶导数来检测边缘。 卷积核 [0,1,0, 1,-4,1, 0,1,0] 对所有方向的快速强度变化都有强响应。

Features | 主要功能:

  • Second-derivative edge detection using 3x3 Laplacian - 使用 3x3 Laplacian 的二阶导数边缘检测
  • Omnidirectional edge sensitivity - 全方向边缘敏感度
  • Absolute value output clamped to [0, 255] - 取绝对值输出并裁剪到 [0, 255]

Usage Examples | 使用示例:

BufferedImage edges = LaplacianOp.apply(image);

Performance | 性能特性:

  • Time complexity: O(w * h * 9) for 3x3 kernel - 时间复杂度: 3x3 卷积核 O(w * h * 9)
  • Space complexity: O(w * h) - 空间复杂度: 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 BufferedImage apply(BufferedImage image)
      Apply Laplacian edge detection to an image. 对图像应用 Laplacian 边缘检测。

      Converts the image to grayscale, applies the 3x3 Laplacian kernel, takes the absolute value of each pixel, and clamps to [0, 255].

      将图像转换为灰度,应用 3x3 Laplacian 卷积核, 对每个像素取绝对值并裁剪到 [0, 255]。

      Parameters:
      image - the source image | 源图像
      Returns:
      the edge-detected image | 边缘检测后的图像
      Throws:
      NullPointerException - if image is null | 当图像为 null 时抛出