10 home_dir = os.environ[
'HOME']
11 with open(os.path.join(home_dir,
'.ros/l_img_crop.json'),
'r') as f: 12 l_json_load = json.load(f) 13 with open(os.path.join(home_dir, '.ros/r_img_crop.json'),
'r') as f: 14 r_json_load = json.load(f) 15 fixedPoints = r_json_load['shapes'][0][
'points']
16 movingPoints = l_json_load[
'shapes'][0][
'points']
17 if len(fixedPoints) != len(movingPoints):
18 print(
'[error] The number of points in both images is different.')
20 dic = {
'fixedPoints': fixedPoints,
21 'movingPoints': movingPoints}
22 mat_path = os.path.join(home_dir,
'.ros/Correspondence_points_for_MLS.mat')
23 scipy.io.savemat(mat_path, dic)
24 print(
'{} point pairs are saved to {}'.format(len(fixedPoints), mat_path))
27 if __name__ ==
'__main__':