11 home_dir = os.environ[
'HOME']
12 mls = scipy.io.loadmat(os.path.join(home_dir,
'.ros/XY_MLS_Grid_example2.mat'))
13 yml_path = os.path.join(home_dir,
'.ros/fisheye_stitcher_grid_xd_yd_3840x1920.yml')
14 with open(yml_path,
'w')
as f:
15 f.write(
'%YAML:1.0\n')
16 for label
in [
'Xd',
'Yd']:
17 rows = mls[label].shape[0]
18 cols = mls[label].shape[1]
19 f.write(
' {}: !!opencv-matrix\n'.format(label))
20 f.write(
' rows: {}\n'.format(rows))
21 f.write(
' cols: {}\n'.format(cols))
24 for i
in range(mls[label].size):
25 f.write(str(mls[label][i / cols][i % cols]))
26 if i < mls[label].size - 1:
32 print(
'{} is exported.'.format(yml_path))
35 if __name__ ==
'__main__':