In [16]:
from PIL import Image #Image Library
from pylab import * #Matplotlib
In [17]:
#load image array
im = array(Image.open('images/empire.jpg'))

# display image
imshow(im)

# create some points
x = [100,100,400,400]
y = [200,500,200,500]

# plot points in red
plot(x,y, 'r*')

# plot connecting points
plot(x[:2],y[:2], 'm')

# remove axis
axis('off')

# add title
title('Plotting: "Empire.jpg"')

show()
In [18]:
# Contour and Histogram Example --------------------------
In [19]:
#load image array in B/W
im_bw = array(Image.open('images/empire.jpg').convert('L'))

# create figure
figure()

#remove colors
gray()

# show contour
contour(im_bw, origin='image')

# axis
axis('equal')
axis('off')

show()
In [20]:
# histogram of pixel distribution
figure()

# flatten converts the image to be
# 1 dimensional 
hist(im_bw.flatten(), 128)

#render
show()