I've read in all the photos from a folder into an array. I'm trying to confirm that this works by displaying the first photos 5 in the array. Here's what I've tried:
def read_img(img_list, img):
n = cv2.imread(img, 0)
img_list.append(n)
return img_list
path = glob.glob("foo/images/*.png")
list_ = []
cv_image = [read_img(list_, img) for img in path]
for i in range(5):
cv2.imshow("images", cv_image[i])
cv2.waitKey(0)
I'm currently getting the error:
cv2.imshow("images", cv_image[i]) TypeError: Expected Ptr<cv::UMat> for argument 'mat'
I'm not very familiar with OpenCV and haven't found a solution online so far. Please let me know.