Created
April 24, 2017 07:01
-
-
Save tmt514/a196ab0e8d05023e91162a56a8c7b459 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
# Windows dependencies | |
# - Python 2.7.6: http://www.python.org/download/ | |
# - OpenCV: http://opencv.org/ | |
# - Numpy -- get numpy from here because the official builds don't support x64: | |
# http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy | |
# Mac Dependencies | |
# - brew install python | |
# - pip install numpy | |
# - brew tap homebrew/science | |
# - brew install opencv | |
cap = cv2.VideoCapture(0) | |
cap.set(cv2.CAP_PROP_FPS, 60) | |
while(True): | |
ret, frame = cap.read() | |
rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA) | |
edges = cv2.Canny(rgb, 100, 200) | |
cv2.imshow('frame', edges) | |
if cv2.waitKey(1) & 0xFF == ord('q'): | |
out = cv2.imwrite('capture.jpg', frame) | |
break | |
cap.release() | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment