Skip to content

Instantly share code, notes, and snippets.

@Jim-Holmstroem
Created April 29, 2017 11:59
Show Gist options
  • Save Jim-Holmstroem/66c819f6589b5859aec026fd027ec376 to your computer and use it in GitHub Desktop.
Save Jim-Holmstroem/66c819f6589b5859aec026fd027ec376 to your computer and use it in GitHub Desktop.
live transform opencv frame by frame
from __future__ import division, print_function
import cv2
id_ = lambda x: x
def live_transform(transformation=id_):
cap = cv2.VideoCapture(0)
while True:
ret, img = cap.read()
cv2.imshow("input", img)
key = cv2.waitKey(10)
if key == 27:
break
cv2.destroyAllWindows()
cv2.VideoCapture(0).release()
if __name__ == "__main__":
live_transform()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment