Create Numpy array of images
<p>I have some (950) 150x150x3 .jpg image files that I want to read into an Numpy array. </p>

<p>Following is my code:</p>

<pre><code>X_data = []
files = glob.glob ("*.jpg")
for myFile in files:
    image = cv2.imread (myFile)
    X_data.append (image)

print('X_data shape:', np.array(X_data).shape)
</code></pre>

<p>The output is <code>(950, 150)</code>. Please let me know why the list is not getting converted to <code>np.array</code> correctly and whether there is a better way to create the array of images.</p>

<p>Of what I have read, appending to numpy arrays is easier done through python lists and then converting them to arrays.</p>

<p>EDIT: Some more information (if it helps), <code>image.shape</code> returns <code>(150,150,3)</code> correctly.</p>