4/16/2023 0 Comments Meshlab youtube![]() Merge_pcd = merge () return merge_pcd def create_mesh_by_meshlab ( mesh_filename ): ms = pymeshlab. transformation ) # draw_registration_result(source, target) Result = refine_registration ( source, target, result_ransac, source_fpfh, target_fpfh, voxel_size ) source. TransformationEstimationPointToPlane ()) return result def prepare_dataset ( source, target, voxel_size ): source_down, source_fpfh = preprocess_point_cloud ( source, voxel_size ) target_down, target_fpfh = preprocess_point_cloud ( target, voxel_size ) return source_down, target_down, source_fpfh, target_fpfh def register ( source, target, voxel_size ): source_down, target_down, source_fpfh, target_fpfh = prepare_dataset ( source, target, voxel_size ) result_ransac = execute_global_registration ( source_down, target_down, source_fpfh, target_fpfh, voxel_size ) # result_ransac = execute_fast_global_registration(source_down, target_down, source_fpfh, target_fpfh, voxel_size) registration_icp ( source, target, distance_threshold, result_ransac. This time we use a strict" ) print ( " distance threshold %.3f." % distance_threshold ) result = o3d. FastGlobalRegistrationOption ( maximum_correspondence_distance = distance_threshold )) return result def refine_registration ( source, target, result_ransac, source_fpfh, target_fpfh, voxel_size ): distance_threshold = voxel_size * 0.4 print ( ":: Point-to-plane ICP registration is applied on original point" ) print ( " clouds to refine the alignment. registration_fast_based_on_feature_matching ( source_down, target_down, source_fpfh, target_fpfh, o3d. ![]() ![]() RANSACConvergenceCriteria ( 400000, 500 )) return result def execute_fast_global_registration ( source_down, target_down, source_fpfh, target_fpfh, voxel_size ): distance_threshold = voxel_size * 0.5 print ( ":: Apply fast global registration with distance threshold %.3f" % distance_threshold ) result = o3d. TransformationEstimationPointToPoint ( False ), 3, , o3d. registration_ransac_based_on_feature_matching ( source_down, target_down, source_fpfh, target_fpfh, True, distance_threshold, o3d. draw_geometries (, zoom = 0.4559, front =, lookat =, up = ) def execute_global_registration ( source_down, target_down, source_fpfh, target_fpfh, voxel_size ): distance_threshold = voxel_size * 1.5 print ( ":: RANSAC registration on downsampled point clouds." ) print ( " Since the downsampling voxel size is %.3f," % voxel_size ) print ( " we use a liberal distance threshold %.3f." % distance_threshold ) result = o3d. KDTreeSearchParamHybrid ( radius = radius_feature, max_nn = 100 )) return pcd_down, pcd_fpfh def draw_registration_result ( source, target ): source_temp = copy. KDTreeSearchParamHybrid ( radius = radius_normal, max_nn = 30 )) radius_feature = voxel_size * 5 print ( ":: Compute FPFH feature with search radius %.3f." % radius_feature ) pcd_fpfh = o3d. voxel_down_sample ( voxel_size ) radius_normal = voxel_size * 2 print ( ":: Estimate normal with search radius %.3f." % radius_normal ) pcd_down. vstack ( all_points )) return merged_pcd def preprocess_point_cloud ( pcd, voxel_size ): print ( ":: Downsample with a voxel size %.3f." % voxel_size ) pcd_down = pcd. draw_geometries ( pcds ) return pcds def merge ( pcds ): all_points = for pcd in pcds : all_points. read_point_cloud ( file ) add_color_normal ( pcd ) pcds. ![]() ![]() estimate_normals ( kdt_n ) def load_pcds ( pcd_files ): print ( ":: Load pcd files, size = %d" % len ( pcd_files )) pcds = for file in pcd_files : pcd = o3d. Import open3d as o3d import numpy as np import copy import pymeshlab # 法線の計算と色付けĭef add_color_normal ( pcd ): pcd. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |