In [21]:
%matplotlib inline

import cv2
import matplotlib.pyplot as plt

In [27]:
bgr = cv2.imread("image077.png")
rgb = cv2.cvtColor(bgr, cv2.COLOR_BGR2RGB)
plt.imshow(rgb)


Out[27]:
<matplotlib.image.AxesImage at 0x7fb07c67e550>

Image Gradients


In [23]:
laplacian = cv2.Laplacian(bgr,cv2.CV_64F)
sobelx = cv2.Sobel(bgr,cv2.CV_64F,1,0,ksize=5)
sobely = cv2.Sobel(bgr,cv2.CV_64F,0,1,ksize=5)

In [24]:
plt.imshow(sobelx, cmap='gray')


Out[24]:
<matplotlib.image.AxesImage at 0x7fb07c0f00d0>

Canny Edge Detection

  1. Noise Reduction
  2. Finding Intensity Gradient of the Image
  3. Non-maximum Suppression
  4. Hysteresis Thresholding

In [25]:
edges = cv2.Canny(bgr,100,200)

In [26]:
plt.imshow(edges, cmap='gray')


Out[26]:
<matplotlib.image.AxesImage at 0x7fb07c121f90>

In [ ]: