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.float32)/9 while(cap.isOpened()): ret, frame = cap.read() if ret==True: frame = cv2.flip(frame,1) # write the flipped frame # out.write(frame) # dst = cv2.filter2D(frame,-1,kernel) dst = cv2.blur(frame,(5,5)) gauss = cv2.GaussianBlur(frame,(5,5),0) grises = cv2.cvtColor(gauss,cv2.COLOR_BGR2GRAY) grisesoriginal = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY) th3 = cv2.adaptiveThreshold(grises,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY,11,2) th3original = cv2.adaptiveThreshold(grisesoriginal,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY,11,2) cv2.imshow('frame',frame) cv2.imshow('Gaussiano',gauss) cv2.imshow('Umbral_sin filtro',th3original) cv2.imshow('img filtrada gaussiana umbral gauss',th3) if cv2.waitKey(1) & 0xFF == ord('q'): break else: break # Release everything if job is finished cap.release() out.release() cv2.destroyAllWindows()