import cv2def Write(): # src= "XXX" # img = cv2.imread(src) # # print(len(List2)) for i in range(80,100): src="XXX"+"img_"+str(i)+".jpg" print(src) img=cv2.imread(src) txt="XXX"+"img_"+str(i)+".jpg.txt" print(txt) f1=open(txt) line=f1.readline() lineindex=0 while line: line =f1.readline() line = line.replace("\n", "") if len(line): List1 = line.split(",") # print(List1) crop = img[int(List1[1]):int(List1[5]), int(List1[0]):int(List1[4])] # print(List1[8]) f2 = open("XXX\test_List.txt", 'a+') outpath = "XXX" + "img_" + str(i) +"_"+str(lineindex)+"_"+str(List1[8])+ ".jpg" outpath2 = "XXX" + "img_" + str(i) +"_"+str(lineindex)+"_"+str(List1[8])+ ".jpg"+"#"+str(List1[8]) f2.write(outpath2 + "\r\n") f2.close() cv2.imwrite(outpath, crop) lineindex=lineindex+1if __name__ == '__main__': Write()
总结
以上是内存溢出为你收集整理的python 根据图形生成单字符图形以及列表全部内容,希望文章能够帮你解决python 根据图形生成单字符图形以及列表所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)