我目前正在使用python来读写大型图像(使用OpenCV和numpy的memmap函数)。具体地说,我正在制作图像金字塔。在
在python中,可以监视文件的当前读写速度吗?一、 e.类似移动平均值(MB/秒)。在
我不认为这很重要,但我的代码中最重要的部分是:for y in range(ysize):
#Open a previously defined temp image file
bigIMG = np.memmap('tempfile.bin', dtype='uint8', mode='r+', shape=(ysize,xsize,3))
#Grap a chunk of the full image, save it, shrink it,
#and put it into the next lower level of the pyramid
for x in range(xsize):
chunk = bigIMG[y*block:(y+1)*block,x*block:(x+1)*block]
cv2.imwrite('+str(x)+"_"+str(y)+".png",chunk)
down = cv2.resize(chunk,None,fx=0.5, fy=0.5, interpolation = cv2.INTER_LINEAR)
smallerIMG[(y*block)/2:((y+1)*block)/2,(x*block)/2:((x+1)*block)/2] = down
#Flush changes to HDD
del smallerIMG
如你所见,我正在从硬盘上写和读很多数据,我想监控这些操作的性能。在
谢谢!在