Skip to content

Instantly share code, notes, and snippets.

@aravindpai
Created March 30, 2020 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aravindpai/622f17d5c05c41c7c9882a751f651cb3 to your computer and use it in GitHub Desktop.
Save aravindpai/622f17d5c05c41c7c9882a751f651cb3 to your computer and use it in GitHub Desktop.
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