Class HarrisCornerOp

java.lang.Object
cloud.opencode.base.image.feature.HarrisCornerOp

public final class HarrisCornerOp extends Object
Harris Corner Detector Harris 角点检测器

Implements the Harris corner detection algorithm for identifying interest points in images where two edges meet, forming a corner.

实现 Harris 角点检测算法,用于识别图像中两条边缘相交形成角点的兴趣点。

Features | 主要功能:

  • Harris corner detection with configurable k and threshold - 可配置 k 和阈值的 Harris 角点检测
  • Top-N corner selection with automatic threshold - 自动阈值的 Top-N 角点选择
  • Corner response image generation for visualization - 生成角点响应图用于可视化
  • Non-maximum suppression (3x3 window) - 非极大值抑制(3x3 窗口)

Usage Examples | 使用示例:

// Detect corners with explicit parameters
List<double[]> corners = HarrisCornerOp.detect(image, 0.04, 1000.0);
for (double[] corner : corners) {
    System.out.printf("Corner at (%d, %d) response=%.2f%n",
        (int) corner[0], (int) corner[1], corner[2]);
}

// Detect top-N corners with automatic threshold
List<double[]> topCorners = HarrisCornerOp.detect(image, 50);

// Get response image for visualization
Raster response = HarrisCornerOp.responseImage(image, 0.04);

Performance | 性能特性:

  • Time complexity: O(w * h * k) where k is kernel size - 时间复杂度: O(w * h * k),k 为卷积核大小
  • Space complexity: O(w * h) for gradient and response arrays - 空间复杂度: 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

    • detect

      public static List<double[]> detect(Raster raster, double k, double threshold)
      Detect Harris corners on a Raster with explicit parameters. 在 Raster 上使用显式参数检测 Harris 角点。
      Parameters:
      raster - the source raster | 源 raster
      k - Harris sensitivity (typically 0.04-0.06) | Harris 灵敏度
      threshold - minimum corner response threshold | 最小响应阈值
      Returns:
      list of [x, y, response], sorted by response descending | [x, y, response] 列表(按响应降序)
      Throws:
      NullPointerException - if raster is null | 当 raster 为 null 时抛出
      Since:
      opencode-base-image V1.0.4
    • detect

      public static List<double[]> detect(Raster raster, int maxCorners)
      Detect Harris corners on a Raster with an automatic threshold, returning at most maxCorners. 在 Raster 上使用自动阈值检测 Harris 角点,最多返回 maxCorners 个。
      Parameters:
      raster - the source raster | 源 raster
      maxCorners - maximum number of corners to return | 返回的最大角点数
      Returns:
      list of [x, y, response], sorted descending | [x, y, response] 列表
      Throws:
      ImageOperationException - if maxCorners is not positive | maxCorners 非正时抛出
      Since:
      opencode-base-image V1.0.4
    • responseImage

      public static Raster responseImage(Raster raster, double k)
      Compute Harris corner response for a Raster and pack the normalized result into a GRAY_8 response image. 计算 Raster 的 Harris 角点响应,归一化后打包为 GRAY_8 响应图。
      Parameters:
      raster - the source raster | 源 raster
      k - Harris sensitivity | Harris 灵敏度
      Returns:
      the GRAY_8 response raster | GRAY_8 响应 raster
      Throws:
      NullPointerException - if raster is null | 当 raster 为 null 时抛出
      Since:
      opencode-base-image V1.0.4