读取批量文件

为了方便查询,

import cv2
import os

import numpy as np

root_path = ""
dir = root_path+"images"+"/"
count = 0
for root,dir,files in os.walk(dir):
for file in files:
srcImg = cv2.imread(root_path+"images"+"/"+str(file))
roiImg = srcImg[36:521, 180:745]
cv2.imwrite(root_path+"Image"+"/"+str(file),roiImg)
count +=1
if count%400==0:
print count

posted @ 2019-09-22 12:03  my_everything  阅读(178)  评论(0编辑  收藏  举报