title: How do I load a list of images into an array for each channel in Numpy?
body: <p>I want an array X of shape (n_samples,n_cols,n_rows,n_channels). I want an array y with a shape (n_sample,n_cols,n_rows,n_channels)</p>
  
  <p>I have tried </p>
  
  <pre><code>import glob
  from skimage import io, color
  import numpy as np
  
  def loadfunc(files)
      for fl in files:
          img = color.rgb2lab(io.imread(fl))
          L = img[:,:,:1]
          ab = img[:,:,1:]
          yield L,ab
  
  X,y = np.fromiter(loadfunc(glob.glob('path/to/images/*.png')),float)
  </code></pre>
  
  <p>and I get this error: ValueError: setting an array element with a sequence.</p>
  
  <p>I figure this must be a somewhat common operation - any time someone wants to load image data into an array in numpy so there must be something Im missing? </p>