Skip to content

Commit

Permalink
updated image example
Browse files Browse the repository at this point in the history
  • Loading branch information
thearn committed Mar 17, 2015
1 parent 64333f3 commit 61742ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions image.py
Expand Up @@ -4,7 +4,7 @@
import matplotlib.pyplot as plt
plt.ion()

from scipy.misc import imread
from scipy.misc import imread, imresize


def conway(state, k=None):
Expand Down Expand Up @@ -33,14 +33,20 @@ def conway(state, k=None):
if __name__ == "__main__":
# set up board
m,n = 100,100
A = imread("NASA.png")
A = np.where(A > 200, 1, 0)
A_original = imresize(imread("test.png"), 0.5)

threshold = 180
A = np.where(A_original > threshold, 0, 1)

R, G, B = A[:,:,0], A[:,:,1], A[:,:,2]

# plot each frame
plt.figure()
img_plot = plt.imshow(A, interpolation="nearest", cmap = plt.cm.gray)
plt.subplot(121)
plt.imshow(A_original,interpolation="nearest")

plt.subplot(122)
img_plot = plt.imshow(A,interpolation="nearest")
plt.show(block=False)
while True:
R, G, B = conway(R), conway(G), conway(B)
Expand Down
Binary file added test.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 61742ff

Please sign in to comment.