finish register
This commit is contained in:
@@ -10,8 +10,8 @@ from PytorchBoot.status import status_manager
|
||||
|
||||
import sys
|
||||
|
||||
sys.path.append("/home/user/nbv_rec/nbv_rec_control")
|
||||
from utils.control_util import ControlUtil
|
||||
sys.path.append(r"C:\Document\Local Project\nbv_rec_control")
|
||||
#from utils.control_util import ControlUtil
|
||||
from utils.communicate_util import CommunicateUtil
|
||||
from utils.pts_util import PtsUtil
|
||||
from utils.view_sample_util import ViewSampleUtil
|
||||
@@ -99,8 +99,8 @@ class CADStrategyRunner(Runner):
|
||||
scan_points_indices_list = scan_points_idx_list,
|
||||
init_view=0,
|
||||
threshold=self.voxel_size,
|
||||
soft_overlap_threshold= self.soft_overlap_threshold,
|
||||
hard_overlap_threshold= self.hard_overlap_threshold,
|
||||
soft_overlap_threshold = self.soft_overlap_threshold,
|
||||
hard_overlap_threshold = self.hard_overlap_threshold,
|
||||
scan_points_threshold = self.scan_points_threshold,
|
||||
status_info=self.status_info
|
||||
)
|
||||
@@ -136,13 +136,22 @@ class CADStrategyRunner(Runner):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
model_path = "/home/user/nbv_rec/data/mesh.obj"
|
||||
model_path = r"C:\Users\hofee\Downloads\mesh.obj"
|
||||
model = trimesh.load(model_path)
|
||||
test_pts_L = np.loadtxt("/home/user/nbv_rec/data/cam_pts_0_L.txt")
|
||||
test_pts_R = np.loadtxt("/home/user/nbv_rec/data/cam_pts_0_R.txt")
|
||||
cad_to_cam_L = PtsUtil.register_icp(test_pts_L, model)
|
||||
cad_to_cam_R = PtsUtil.register_icp(test_pts_R, model)
|
||||
cad_pts_L = PtsUtil.transform_point_cloud(test_pts_L, cad_to_cam_L)
|
||||
cad_pts_R = PtsUtil.transform_point_cloud(test_pts_R, cad_to_cam_R)
|
||||
np.savetxt("/home/user/nbv_rec/data/cad_pts_0_L.txt", cad_pts_L)
|
||||
np.savetxt("/home/user/nbv_rec/data/cad_pts_0_R.txt", cad_pts_R)
|
||||
test_pts_L = np.load(r"C:\Users\hofee\Downloads\0.npy")
|
||||
|
||||
import open3d as o3d
|
||||
def add_noise(points, translation, rotation):
|
||||
R = o3d.geometry.get_rotation_matrix_from_axis_angle(rotation)
|
||||
noisy_points = points @ R.T + translation
|
||||
return noisy_points
|
||||
|
||||
translation_noise = np.random.uniform(-0.5, 0.5, size=3)
|
||||
rotation_noise = np.random.uniform(-np.pi/4, np.pi/4, size=3)
|
||||
noisy_pts_L = add_noise(test_pts_L, translation_noise, rotation_noise)
|
||||
|
||||
cad_to_cam_L = PtsUtil.register(noisy_pts_L, model)
|
||||
|
||||
cad_pts_L = PtsUtil.transform_point_cloud(noisy_pts_L, cad_to_cam_L)
|
||||
np.savetxt(r"test.txt", cad_pts_L)
|
||||
np.savetxt(r"src.txt", noisy_pts_L)
|
Reference in New Issue
Block a user