import numpy as np import cv2 cap = cv2.VideoCapture(0) # Define the codec and create VideoWriter object #ourcc = cv2.cv.CV_FOURCC(*'XVID') # cv2.VideoWriter_fourcc() does not exist #ut = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480)) kernel = np.ones((3,3),np.uint8) while(cap.isOpened()): ret, frame = cap.read() if ret==True: # img = cv2.flip(frame,1) # write the flipped frame # out.write(frame) # dst = cv2.filter2D(frame,-1,kernel) img = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY) # Output dtype = cv2.CV_8U edges = cv2.Canny(img,150,180) cv2.imshow('frame',frame) cv2.imshow('Bordes',edges) if cv2.waitKey(1) & 0xFF == ord('q'): break else: break # Release everything if job is finished cap.release() cv2.destroyAllWindows()