In [54]:
import cv2, matplotlib
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

In [60]:
pic_name = "M3RQJCg-1200"

In [61]:
pic = cv2.imread(pic_name + ".jpg")

In [62]:
pic_preprocessed  = cv2.cvtColor(cv2.GaussianBlur(pic, (7,7), 0), cv2.COLOR_BGR2GRAY)

In [68]:
pic_edges = cv2.bitwise_not(cv2.Canny(pic_preprocessed, threshold1=20, threshold2=60))
plt.imshow(cv2.cvtColor(pic_edges, cv2.COLOR_GRAY2RGB))


Out[68]:
<matplotlib.image.AxesImage at 0x23d9353d048>

In [69]:
cv2.imwrite(pic_name + "_edges.jpg", pic_edges)


Out[69]:
True

In [ ]:
plt.i