有没有一种方法可以更快地执行下面的代码行?
arr = cv2.imdecode(np.frombuffer(tar.extractfile(img).read(), cv2.IMREAD_COLOR)
答案 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))