Issue
from PIL import Image
import glob
import pandas as pd
This is the CSV file that I read in and filtered out...
Metadata = pd.read_csv('ISIC_2019_Training_GroundTruth.csv')
MelanomaData = Metadata.filter(["Images" ,"MEL"])
MelanomaData = MelanomaData[MelanomaData.MEL == 1]
The search criteria in the image column, the image ID is what I want to read in a folder (the folder has different images in there which I don't want to read in). The images are .jpg
I coded this to read in the images
image_list = []
for filename in (glob.glob('/Users/user/Documents/Final Year Proj/DATA/ISIC_2019_Training_Input/*.jpg')):
im=Image.open(filename)
image_list.append(im)
print(filename)
Solution
You are almost there, you can simply extract the list of images from you dataframe and read them with your function:
image_name_list = MelanomaData['Images'].tolist()
path_string = '/Users/user/Documents/Final Year Proj/DATA/ISIC_2019_Training_Input/'
for image_name in image_name_list:
im = Image.open(path_string + image_name + '.jpg')
image_list.append(im)
Answered By - LeoE
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.