1# Open3D: www.open3d.org 2# The MIT License (MIT) 3# See license file or visit www.open3d.org for details 4 5import os 6import sys 7sys.path.append("../Advanced") 8sys.path.append("../Utility") 9import numpy as np 10from common import * 11from downloader import * 12from fast_global_registration import * 13from trajectory_io import * 14 15import pickle 16 17do_visualization = False 18 19def get_ply_path(dataset_name, id): 20 return "%s/%s/cloud_bin_%d.ply" % (dataset_path, dataset_name, id) 21 22 23def get_log_path(dataset_name): 24 return "%s/fgr_%s.log" % (dataset_path, dataset_name) 25 26dataset_path = 'testdata' 27dataset_names = ['livingroom1','livingroom2','office1','office2'] 28 29if __name__ == "__main__": 30 # data preparation 31 get_redwood_dataset() 32 voxel_size = 0.05 33 34 # do RANSAC based alignment 35 for dataset_name in dataset_names: 36 ply_file_names = get_file_list( 37 "%s/%s/" % (dataset_path, dataset_name), ".ply") 38 n_ply_files = len(ply_file_names) 39 40 alignment = [] 41 for s in range(n_ply_files): 42 source = read_point_cloud(get_ply_path(dataset_name, s)) 43 source_down, source_fpfh = preprocess_point_cloud( 44 source, voxel_size) 45 f = open('store.pckl', 'wb') 46 pickle.dump([source_down, source_fpfh], f) 47 f.close() 48