title: How do I create a list of all my folder ('train') images in OpenCV
body: <p>I have 399 images in my folder called 'train_images', I'd like to create a list of all these images in my openCV like ('cv2.imread(list)')</p>
  
  <pre><code>TRAIN_DIR = 'train_data/'
  TEST_DIR = 'test_data/'
  
  train_path = glob.glob("train_data/*.ppm")
  
  train_path.sort()
  
  train_images = [cv2.imread(img) for img in train_path]
  
  
  train_images = train_images.reshape(train_images.shape[0], 512, 512, 1).astype('float32')
  
  cv2.imshow('image',train_images[0])
  cv2.waitKey(0)
  cv2.destroyAllWindows()
  </code></pre>