使用Python写简单的点云harris 3D关键点检测

一、代码

Python

import numpy as np
import open3d as o3d


def compute_harris_keypoints_optimized(point_cloud, rad, thresh):
    if not point_cloud.has_normals():
        point_cloud.estimate_normals(search_param=o3d.geometry.KDTreeSearchParamHybrid(radius=0.1, max_nn=30))

    # 创建KD树
    kdtree = o3d.geometry.KDTreeFlann(point_cloud)

    points = np.asarray(point_cloud.points)
    num_points = points.shape[0]
    harris_responses = np.zeros(num_points)
    keypoints_idx = []

    # 使用向量化计算协方差矩阵和Harris响应
    for i in range(num_points):
        [_, idx, _] = kdtree.search_radius_vector_3d(point_cloud.points[i], rad)
        if len(idx) >= 3:
            neighbors = points[idx, :]
            # 减去均值以进行去中心化
            neighbor_shifted = neighbors - neighbors.mean(axis=0)
            # 计算去中心化之后的协方差矩阵
            cov = np.dot(neighbor_shifted.T, neighbor_shifted) / len(neighbor_sh

相关推荐

最近更新

  1. TCP协议是安全的吗?

    2024-04-05 05:20:03       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-05 05:20:03       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-05 05:20:03       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-05 05:20:03       18 阅读

热门阅读

  1. HDFS、TFS 和 Ceph的对比(通往架构师的路上)

    2024-04-05 05:20:03       9 阅读
  2. JVM剖析

    JVM剖析

    2024-04-05 05:20:03      11 阅读
  3. 图DP

    图DP

    2024-04-05 05:20:03      8 阅读
  4. Linux中关于网络方面常用命令行介绍

    2024-04-05 05:20:03       10 阅读
  5. Megatron-DeepSpeed-GPU-多机训练

    2024-04-05 05:20:03       14 阅读
  6. c++ new int[10]()会进行初始化.

    2024-04-05 05:20:03       10 阅读
  7. 【Python】【Flask】提交表单后报500错误

    2024-04-05 05:20:03       9 阅读
  8. css隐藏溢出隐藏的滚动条

    2024-04-05 05:20:03       13 阅读
  9. Pod安全上下文与Linux Capabilities浅析

    2024-04-05 05:20:03       12 阅读
  10. 递归与树的深度优先搜索:探索它们之间的关系

    2024-04-05 05:20:03       12 阅读
  11. Go语言中正则表达式简介

    2024-04-05 05:20:03       12 阅读
  12. Tokio强大的Rust异步框架

    2024-04-05 05:20:03       16 阅读
  13. 百问网FreeRTOS学习笔记第50到56讲

    2024-04-05 05:20:03       10 阅读