Commit 286acf27 authored by oscar's avatar oscar

提交修改

parent e6f31465
......@@ -9,6 +9,8 @@ import shutil as sh
import copy
from scipy.spatial.transform import Rotation as R
import cv2
from scipy.spatial import Delaunay
import scipy
def compute_pitch(A,B,C):
......@@ -389,6 +391,23 @@ def custom_draw_geometry_with_key_callback(pcd, file_path):
key_to_callback[ord("S")] = save_pcd
o3d.visualization.draw_geometries_with_key_callbacks(pcd, key_to_callback)
def in_hull(p, hull):
"""
:param p: (N, K) test points
:param hull: (M, K) M corners of a box
:return (N) bool
"""
try:
if not isinstance(hull, Delaunay):
hull = Delaunay(hull)
flag = hull.find_simplex(p) >= 0
except scipy.spatial.qhull.QhullError:
print('Warning: not a hull %s' % str(hull))
flag = np.zeros(p.shape[0], dtype=np.bool)
return flag
if __name__ == '__main__':
root_path = "D:/work/git_workspace/jfxmap_python/script/data_aug_samples/"
......@@ -424,8 +443,12 @@ if __name__ == '__main__':
print(pcd)
print(converted_pcd)
xyz = np.array(pcd.points)
merge_geos = [pcd]
for bbox in bboxes:
flag = in_hull(xyz,bbox[1])
print(xyz[flag])
#渲染bbox
merge_geos += [gen_o3d_3dbboxes(bbox[1])]
heading_point = (bbox[3][0] + bbox[3][2]) / 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment