Skip to content

Instantly share code, notes, and snippets.

@aagontuk
Last active December 12, 2017 10:49
Show Gist options
  • Save aagontuk/3ea00a9a07829a03bfae2ab0d2130558 to your computer and use it in GitHub Desktop.
Save aagontuk/3ea00a9a07829a03bfae2ab0d2130558 to your computer and use it in GitHub Desktop.
Canny edge detection
import cv2
import numpy as np
img = cv2.imread(example.jpg)
imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(imgGray, (5, 5), 0)
imgCanny = cv2.Canny(blurred, 50, 80)
cv2.namedWindow('Canny Edge', cv2.WINDOW_NORMAL)
cv2.imshow('Canny Edge', imgCanny)
cv2.waitKey(0)
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment