我目前正在使用500万像素摄像头进行一些图像处理。我正在使用cpp以CV2格式转换来自相机的图像。然后我使用Python脚本加载它们来处理图像。使用cv2.imread()和以下代码加载200张图像需要9.426秒:
images = glob.glob('InputSimulation\*.jpg')
#images = Glob.fileList("InputSimulation"+os.sep)
# images = images.sort()
# sort out all characters just let the string remain
images = sorted(images, key=lambda name: int(name[22:-4]))
# TestNewMethod
index = 0
cv2ImageList = []
for fname in images:
#for testing reasons
if index % skip_fac != 0:
continue
cv2ImageList.append(cv2.imread(fname))
我不确定是否有比使用cv2.imread()和for循环更快的方法。有什么建议吗?