Skip to content

Instantly share code, notes, and snippets.

@aravindpai
Created March 30, 2020 13:54
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
import os
import cv2
import numpy as np
import pandas as pd
folders=os.listdir('data/')
images=[]
labels= []
for folder in folders:
files=os.listdir('data/'+folder)
for file in files:
img=cv2.imread('data/'+folder+'/'+file,0)
img=cv2.resize(img,(25,25))
images.append(img)
labels.append(int(folder))
images = np.array(images)
features = images.reshape(len(images),-1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment