Skip to content

Instantly share code, notes, and snippets.

@wolframalpha
Created June 17, 2019 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolframalpha/a67508a65b531226b5af667298879010 to your computer and use it in GitHub Desktop.
Save wolframalpha/a67508a65b531226b5af667298879010 to your computer and use it in GitHub Desktop.
use this code for canny edge detection
# %matplotlib inline
import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt
img = cv.imread('Sample/Sample.tif')
edges = cv.Canny(img,100,200)
plt.figure(figsize=(30, 25))
# plt.subplot(121),plt.imshow(img,cmap = 'gray')
# plt.title('Original Image'), plt.xticks([]), plt.yticks([])
# plt.subplot(122),plt.imshow(edges,cmap = 'gray')
# plt.title('Edge Image'), plt.xticks([]), plt.yticks([])
# plt.savefig('Sample/OriginalvsCannyED.jpg')
plt.imshow(edges, cmap='gray')
plt.savefig('Sample/cannyED.jpg')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment