因为没有看到有python版本的点云区域增长代码,所以自己写了一个,效果如下:
-
- # -*-coding:utf-8 -*-
- import open3d as o3d
- import matplotlib.pyplot as plt
- import os
- import numpy as np
-
-
-
- def angle2p(N1, N2):
- # Input two normals, return the angle
- dt = N1[0] * N2[0] + N1[1] * N2[1] + N1[2] * N2[2]
- dt = np.arccos(np.clip(dt, -1, 1))
- r_Angle = np.degrees(dt)
- return r_Angle
-
-
- class RegionGrowing:
- def __init__(self):
- """
- Init parameters
- """
- self.pcd = None # input point clouds
- self.NPt = 0 # input point clouds
- self.nKnn = 20 # normal estimation using k-neighbour
- self.nRnn = 0.1 # normal estimation using r-neighbour
- self.rKnn = 20 # region growing using k-