You can’t send the whole Pandas dataframe into cv2.imread
. You want to access the actual file itself. You also want to append with the image, not a list containing just the image to allow for easier accessing:
data = []
for i in range(len(train_data)):
img_array = cv2.imread(train_data.loc[i, 'file'], 1)
data.append(img_array)
solved Getting an error while reading image using cv2.imread() [closed]