Skip to content

Instantly share code, notes, and snippets.

@Hironsan
Last active July 14, 2016 07:44
Show Gist options
  • Save Hironsan/ec97cad4e89802f74abe097d6e3ff34b to your computer and use it in GitHub Desktop.
Save Hironsan/ec97cad4e89802f74abe097d6e3ff34b to your computer and use it in GitHub Desktop.
import os
# import cv2
def read_image(file_path):
# cv2.read(file_path, 1) # grayscale
pass
def traverse_dir(path):
for file_or_dir in os.listdir(path):
abs_path = os.path.abspath(os.path.join(path, file_or_dir))
if os.path.isdir(abs_path): # dir
traverse_dir(abs_path)
else: # file
if abs_path.endswith('pgm'):
read_image(abs_path)
if __name__ == '__main__':
traverse_dir("./CroppedYale")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment