# -*- coding:utf-8 -*- # @Author len # @Create 2023/12/26 9:37 # print(flag) # print(width/background.shape[1]) # print(height / background.shape[0]) # print(x_offset / background.shape[1]) # print(y_offset / background.shape[0]) # print(output_path.split('.')[0] + '.txt') print() path_txt = output_path.split('.')[0] + '.txt' result = (flag + " " + str(width / background.shape[1]) + " " + str(height / background.shape[0]) + " " + str(x_offset / background.shape[1]) + " " + str(y_offset / background.shape[0])) print(result) with open(path_txt, 'w') as f: f.write(result)