In [ ]:
!wget http://www7.pcmag.com/media/images/407653-333.jpg?thumb=y
!mv 407653-333.jpg?thumb=y test2.jpg

In [ ]:
%matplotlib inline
import cv2, pylab
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
image = cv2.imread('test2.jpg')
cv_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
plt.imshow(cv_rgb)
plt.show()

In [ ]:
cv_gray = cv2.cvtColor(cv_rgb,cv2.COLOR_BGR2GRAY)
plt.imshow(cv_gray, cmap=cm.Greys_r)
plt.show()

In [ ]:
from skimage import feature
# Compute the Canny filter for two values of sigma
edges1 = feature.canny(cv_gray)
edges2 = feature.canny(cv_gray, sigma=3)
# display results
fig, (ax1, ax2, ax3) = plt.subplots(nrows=1, ncols=3, figsize=(8, 3),
                                    sharex=True, sharey=True)
ax1.imshow(cv_gray, cmap=plt.cm.gray)
ax1.axis('off')
ax1.set_title('noisy image', fontsize=20)

ax2.imshow(edges1, cmap=plt.cm.gray)
ax2.axis('off')
ax2.set_title('Canny filter, $\sigma=1$', fontsize=20)

ax3.imshow(edges2, cmap=plt.cm.gray)
ax3.axis('off')
ax3.set_title('Canny filter, $\sigma=3$', fontsize=20)

#fig.tight_layout()

plt.show()

In [ ]:
from skimage import feature
# Compute the Canny filter for two values of sigma
edges1 = feature.canny(cv_gray)
edges2 = feature.canny(cv_gray, sigma=2)
plt.imshow(edges2, cmap=cm.Greys_r)
plt.show()

In [ ]:
image = cv2.imread('Screenshot_2016-02-23-12-47-43.png')
cv1_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
cv1_gray = cv2.cvtColor(cv1_rgb,cv2.COLOR_BGR2GRAY)
plt.imshow(cv1_gray, cmap=cm.Greys_r)
plt.show()