import os
import cv2
base_path = r"/home/lockingball/graduate/project/ehang/角度数据/测试数据/img/805/90"
new_path = r"/home/lockingball/graduate/project/ehang/角度数据/测试数据/img/805/90_1"
# with open(new_path,'w') as f:
num = 0
for root,dirs,files in os.walk(base_path):
files.sort(key=lambda x: int(x[:-4]))
for file in files:
num_ = str(num)
img_newname = "901" + num_.zfill(6) + ".jpg"
new_files = new_path + "/" + img_newname
old_image = cv2.imread(root + "/" + file)
print(root + "/" + file)
print(new_files)
print("\n")
cv2.waitKey(0)
cv2.imwrite(new_files, old_image)
num = num + 1