Class HarrisCornerOp
java.lang.Object
cloud.opencode.base.image.feature.HarrisCornerOp
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 Summary
Modifier and TypeMethodDescriptionstatic List<double[]> Detect Harris corners on aRasterwith explicit parameters.static List<double[]> Detect Harris corners on aRasterwith an automatic threshold, returning at mostmaxCorners.static RasterresponseImage(Raster raster, double k) Compute Harris corner response for aRasterand pack the normalized result into aGRAY_8response image.
-
Method Details
-
detect
- Parameters:
raster- the source raster | 源 rasterk- 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
Detect Harris corners on aRasterwith an automatic threshold, returning at mostmaxCorners. 在Raster上使用自动阈值检测 Harris 角点,最多返回maxCorners个。- Parameters:
raster- the source raster | 源 rastermaxCorners- 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
Compute Harris corner response for aRasterand pack the normalized result into aGRAY_8response image. 计算Raster的 Harris 角点响应,归一化后打包为GRAY_8响应图。- Parameters:
raster- the source raster | 源 rasterk- Harris sensitivity | Harris 灵敏度- Returns:
- the
GRAY_8response raster |GRAY_8响应 raster - Throws:
NullPointerException- if raster is null | 当 raster 为 null 时抛出- Since:
- opencode-base-image V1.0.4
-