从Pandas DataFrame中的图像路径读取图像

时间:2020-07-21 14:01:28

标签: python pandas numpy

我在pandas DataFrame中有一列图像路径。它由99.8万行组成。

例如:

data['ImagesPaths'] = {'path1', 'path2', etc...}

我想将cv2.read()应用于此列以具有“图像阵列”列

您如何建议这样做以获得快速效果?

1 个答案:

答案 0 :(得分:0)

看起来您只想遍历data ['ImagesPaths']列,可以很容易地完成该操作:

for image_path in data['ImagesPaths']:
    image = cv2.read(image_path)
    # do smth. 

我认为image_path检索的速度在这里不是问题,大部分时间将花费在图像读取和处理上。

相关问题