import glob
import cv2
import os
import shutilif __name__ == '__main__':imgPath = 'E:\\original-data\\picture\\test\\img'savePath = 'E:\\original-data\\picture\\test\\save\\'filename = os.listdir(imgPath)totalTxt = "E:\\original-data\\picture\\label\\"for fn in filename:fn = fn.replace("png", "txt")txtPath = totalTxt + fnshutil.copyfile(txtPath, savePath + fn)
import glob
import cv2
import osif __name__ == '__main__':txtPath = 'E:\\original-data\\picture\\test\\txt'savePath = 'E:\\original-data\\picture\\test\\save\\'filename = os.listdir(txtPath)totalImg = "E:\\original-data\\picture\\pic\\"for fn in filename:fn = fn.replace("txt", "png")ImgPath = totalImg + fnimg = cv2.imread(ImgPath)cv2.imwrite(savePath + fn, img)