create_mls_correspondence.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 import json
5 import os
6 import scipy.io
7 
8 
9 def main():
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.')
19  exit()
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))
25 
26 
27 if __name__ == '__main__':
28  main()


jsk_perception
Author(s): Manabu Saito, Ryohei Ueda
autogenerated on Mon May 3 2021 03:03:27