用scipy load mat文件
mat文件的存儲格式是字典
import scipy.io as scio
讀取mat文件里面的數據,box的坐標還有filename
XYdata = scio.loadmat(MatFile)['KEY']
filename=,,,,,,,,
fileNub = len(XYdata)
for i, rois in enumerate(XYdata):
Name = filename[i]
img = Image.open(IMGPATH)
for box in rois:
newBox = (box[0],box[1],box[2],box[3])
CropedImg = img.crop(newBox)
CropesImg.save(SAVEPATH)
新聞熱點
疑難解答