我怎样才能更快地执行cv2.imcode()?

时间:2019-02-12 22:15:14

标签: python image-processing computer-vision cv2

有没有一种方法可以更快地执行下面的代码行?

arr = cv2.imdecode(np.frombuffer(tar.extractfile(img).read(), cv2.IMREAD_COLOR)

1 个答案:

答案 0 :(得分:0)

这快得多:

from PIL import Image
import io
import numpy as np
import tarfile

f = io.BytesIO()
f.write(tar.extractfile(tiff).read())
f.seek(0)
arr = np.array(Image.open(f))