如何提高执行速度(python opencv)

时间:2017-10-20 12:15:43

标签: python opencv

我编写了一个代码,它将图像分成两部分,并与同一文件夹中的其他图像重复此操作。 但是,执行速度非常慢。你知道速度加快了吗?

import os
import cv2
from scipy import ndimage
files = os.listdir()
os.makedirs('Dist')

for file in files:
    img = cv2.imread(file)

    dst_upper_right = img[0:1620,0:2400]
    dst_upper_right = ndimage.rotate(dst_upper_right,270)
    cv2.imwrite('./Dist/dst_'+file+'_02.jpg',dst_upper_right)

    dst_lower_left = img[1621:3240,0:2400]
    dst_lower_left = ndimage.rotate(dst_lower_left,270)
    cv2.imwrite('./Dist/dst_'+file+'_01.jpg',dst_lower_left)

0 个答案:

没有答案