Skip to content

Instantly share code, notes, and snippets.

@benwaffle
Created January 8, 2015 01:17
Show Gist options
  • Save benwaffle/eb13c2ac2f809dec79de to your computer and use it in GitHub Desktop.
Save benwaffle/eb13c2ac2f809dec79de to your computer and use it in GitHub Desktop.
edge detection in python
#!/usr/bin/env python2
from cv2 import *
cap = VideoCapture(0)
namedWindow('frame', flags=WINDOW_NORMAL)
createTrackbar('threshold', 'frame', 0, 1024, lambda x: x)
while(True):
ret, frame = cap.read()
x = getTrackbarPos('threshold','frame')
imshow('frame',Canny(frame, x, x))
if waitKey(1) & 0xFF == ord('q'): break
cap.release()
destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment