Skip to content

Instantly share code, notes, and snippets.

@babo
Created January 5, 2017 14:14
Show Gist options
  • Save babo/d6632689adeebb97a39ef0818b01b6f9 to your computer and use it in GitHub Desktop.
Save babo/d6632689adeebb97a39ef0818b01b6f9 to your computer and use it in GitHub Desktop.
Import images using cv2
import os
import cv2
import numpy as np
own_pictures = []
dirname = './extra_images/'
for fn in os.listdir(dirname):
try:
img = cv2.imread(os.path.join(dirname, fn))
img = cv2.resize(img, (32, 32))
own_pictures.append(np.array(img))
except Exception as e:
pass
own_pictures = np.asarray(own_pictures)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment