I'm trying to write my own machine learning scripts on python (I know there are libraries for that but this is purely for the fun of it - I'm in the process of learning Python). I have the following array;
[array([[[ 5, 5, 5, 255],
[ 6, 6, 6, 255],
[ 6, 6, 6, 255],
...,
[ 12, 12, 12, 255],
[ 10, 10, 10, 255],
[ 10, 10, 10, 255]],
[[ 8, 8, 8, 255],
[ 10, 10, 10, 255],
[ 14, 14, 14, 255],
...,
[ 15, 15, 15, 255],
[ 13, 13, 13, 255],
[ 13, 13, 13, 255]],
It continues on like this for some time. I've got this array using the follow code:
imagesList = listdir("someaddress")
loadedImages = []
for image in imagesList:
#img = PImage.open()
loadedImages.append(misc.imread("someaddress" + image))
My logic here is I want to read in image files as arrays of pixel values for use in a image classification problem. As you can tell from the data above, the images are grey scale. I'd like to remove a dimension from this data and just have a single value for each pixel (eg, ([[[5],[6],[6],[12]...) The 255's are just the alpha values (which I don't care about). I know this is array splicing that I need to use, but boy do I have no idea how to apply it to this problem.
I've tried; loadedImages[:,1]
I get the following error;
TypeError: list indices must be integers, not tuple
The result I really want out of this would look as follows
[array([[ 5,
6,
6,
...,
12,
10,
10],
[ 8,
10,
14,
...,
15,
13,
13,