How do i read in selective image files from a folder, where the search criteria is in a PandaFrame frame? Through cv2 in Python

南笙酒味 提交于 2020-02-08 10:46:07

问题


from PIL import Image 

import cv2
import matplotlib.pyplot as plt
import pandas as pd
import os

The following is the filtering out the pandaframe

#######################################################
m = 3000
Metadata = pd.read_csv('ISIC_2019_Training_GroundTruth.csv')

MelanomaData = Metadata.filter(["image" ,"MEL"])
MelanomaData = MelanomaData[MelanomaData.MEL == 1] 
MelanomaData = MelanomaData[:-m]

When i tried to read in the image files i get NonType in my variable explorer view

ImageList = []
ResizingImages = []
image_name_list  = MelanomaData['image'].tolist()
path_string = 'H:/My Documents/FYP/Skin Detection/ISIC_2019_Training_Input/'

datapath = os.path.join(path_string, '.jpg')

for files in datapath:    
    for image_name in image_name_list:
        img = cv2.imread(image_name)
        ImageList.append(img)

The search criteria is found in the image column

    image                                MEL

2   ISIC_0000002                         1.0

4   ISIC_0000004                         1.0

12  ISIC_0000013                         1.0

21  ISIC_0000022_downsampled             1.0

This is the CSV file screen shot but, i only need the image and MEL columns, which is what i extracted, and displayed in the first section where i extracted and filtered that column

enter image description here

This is the link to the csv file https://docs.google.com/spreadsheets/d/1I8wxWn6oIzgHw8xcjK5LWi_z7gS6zv87QNnGNTi1Zbk/edit?usp=sharing

来源:https://stackoverflow.com/questions/60020697/how-do-i-read-in-selective-image-files-from-a-folder-where-the-search-criteria

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!