title: get a numpy array from a sequence of images in a folder
body: <p>I have a folder, say <code>video1</code> with bunch of images in order <code>frame_00.png, frame_01.png, ...</code> </p>
  
  <p>What I want is a 4D numpy array in the format <code>(number of frames, w, h, 3)</code></p>
  
  <p>This is what I did, but I think it is quite slow, is there any faster or more effecient method to achieve the same thing?</p>
  
  <pre><code>folder = "video1/"
  
  import os
  images = sorted(os.listdir(folder)) #["frame_00", "frame_01", "frame_02", ...]
  
  from PIL import Image 
  import numpy as np 
  
  video_array = []
  for image in images:
      im = Image.open(folder + image)
      video_array.append(np.asarray(im)) #.transpose(1, 0, 2))
  
  video_array = np.array(video_array)
  print(video_array.shape)
  #(75, 50, 100, 3)
  </code></pre>