I have the follow method to get all the images from a dir:
def ReadImages(Path):
LabelList = list()
ImageCV = list()
classes = ["nonPdr", "pdr"]
width = 605
height = 700
dim = (width, height)
# Get all subdirectories
FolderList = os.listdir(Path)
# Loop over each directory
for File in FolderList:
if(os.path.isdir(os.path.join(Path, File))):
for Image in os.listdir(os.path.join(Path, File)):
# Convert the path into a file
ImageCV.append(cv2.imread(os.path.join(Path, File) + os.path.sep + Image))
# Add a label for each image and remove the file extension
LabelList.append(classes.index(os.path.splitext(File)[0]))
else:
ImageCV.append(cv2.imread(os.path.join(Path, File) + os.path.sep + Image))
# Add a label for each image and remove the file extension
LabelList.append(classes.index(os.path.splitext(File)[0]))
return ImageCV, LabelList
But my images are bigger and a want to reduce its wxh to 605x700, then I tried to do something like This:
imgR = cv2.resize(ImageCV[Image])
And it not works.. What can I do to resize all these images? I appreciate any help.