我正在尝试将图像数据集导入到test_image变量。我想试试这种方式,因为在我看来它更好看。但是我发现了一个错误:
(内置函数imread()返回NULL )
import cv2 as cv
import os
test_images_path = './test_images/'
test_image = [cv.imread(os.path.join(test_images_path, image) for image in os.listdir(test_images_path))]发布于 2020-02-01 13:15:16
cv.imread()的括号位于错误的位置:
import cv2 as cv
import os
test_images_path = './test_images/'
test_images = [cv2.imread(os.path.join(test_images_path, image)) for image in os.listdir(test_images_path)]
for img in test_images:
cv2.imshow('img', img)
cv2.waitKey(0)发布于 2020-01-31 16:50:18
我认为您没有明确指定要从其中获取图像的路径,请确保将图像保存在保存您python文件的相同位置。
https://stackoverflow.com/questions/60007993
复制相似问题