In [1]:
import matplotlib.pyplot as plt
%matplotlib inline

import numpy as np

In [ ]:
data = np.load("data.npy")
data[0][1]

In [ ]:
prs = map(lambda x: x[0], filter(lambda x: x[1], data[0][1].iteritems()))

In [ ]:
map(lambda x: x[0], data[0][1].iteritems()).index('space')

In [ ]:
[x for x in data[0][1].iteritems()]

In [ ]:
plt.imshow(data[0][0])

In [ ]:
import subprocess

In [ ]:
cmd = 'xwininfo -name "Super Meat Boy"'
ps = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
output = ps.communicate()[0]
print output

In [ ]:
import re
x = re.search(r'upper-left\s+X.\s+(\d+)', output).group(1)
y = re.search(r'upper-left\s+Y.\s+(\d+)', output).group(1)
w = re.search(r'Width:\s+(\d+)', output).group(1)
h = re.search(r'Height:\s+(\d+)', output).group(1)

In [ ]:
x, y, w, h

In [2]:
data = np.load("processed.npy")

In [3]:
data[100][0].shape


Out[3]:
(64, 96, 3)

In [4]:
plt.imshow(data[100][0])


Out[4]:
<matplotlib.image.AxesImage at 0x7fc4706024d0>

In [ ]:
data

In [5]:
X = map(lambda x: x[0], data)

In [6]:
X = np.array(X)

In [7]:
plt.imshow(X[0])


Out[7]:
<matplotlib.image.AxesImage at 0x7fc4705f9dd0>

In [8]:
X[0]


Out[8]:
array([[[0, 0, 0],
        [0, 0, 0],
        [0, 0, 0],
        ..., 
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0]],

       [[0, 0, 0],
        [0, 0, 0],
        [0, 0, 0],
        ..., 
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0]],

       [[0, 0, 0],
        [0, 0, 0],
        [0, 0, 0],
        ..., 
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0]],

       ..., 
       [[0, 0, 0],
        [0, 0, 0],
        [0, 0, 0],
        ..., 
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0]],

       [[0, 0, 0],
        [0, 0, 0],
        [0, 0, 0],
        ..., 
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0]],

       [[0, 0, 0],
        [0, 0, 0],
        [0, 0, 0],
        ..., 
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0]]], dtype=uint8)

In [9]:
X[0][:10]


Out[9]:
array([[[  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0],
        ..., 
        [  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0]],

       [[  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0],
        ..., 
        [  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0]],

       [[  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0],
        ..., 
        [  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0]],

       ..., 
       [[  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0],
        ..., 
        [  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0]],

       [[210, 245, 220],
        [210, 245, 220],
        [210, 245, 220],
        ..., 
        [210, 245, 220],
        [210, 245, 220],
        [210, 245, 220]],

       [[210, 245, 220],
        [210, 245, 220],
        [210, 245, 220],
        ..., 
        [210, 245, 220],
        [210, 245, 220],
        [210, 245, 220]]], dtype=uint8)

In [11]:
i = X[0]

In [12]:
i[i == 0] = 1.0

In [13]:
i


Out[13]:
array([[[1, 1, 1],
        [1, 1, 1],
        [1, 1, 1],
        ..., 
        [1, 1, 1],
        [1, 1, 1],
        [1, 1, 1]],

       [[1, 1, 1],
        [1, 1, 1],
        [1, 1, 1],
        ..., 
        [1, 1, 1],
        [1, 1, 1],
        [1, 1, 1]],

       [[1, 1, 1],
        [1, 1, 1],
        [1, 1, 1],
        ..., 
        [1, 1, 1],
        [1, 1, 1],
        [1, 1, 1]],

       ..., 
       [[1, 1, 1],
        [1, 1, 1],
        [1, 1, 1],
        ..., 
        [1, 1, 1],
        [1, 1, 1],
        [1, 1, 1]],

       [[1, 1, 1],
        [1, 1, 1],
        [1, 1, 1],
        ..., 
        [1, 1, 1],
        [1, 1, 1],
        [1, 1, 1]],

       [[1, 1, 1],
        [1, 1, 1],
        [1, 1, 1],
        ..., 
        [1, 1, 1],
        [1, 1, 1],
        [1, 1, 1]]], dtype=uint8)

In [ ]: