#NEWLINE# def webcam_gui( filter_func , video_src = 0 ) : #NEWLINE# #INDENT# cap = cv2 . VideoCapture ( video_src ) #NEWLINE# key_code = ( - 1 ) #NEWLINE# while ( key_code == ( - 1 ) ) : #NEWLINE# #INDENT# ( ret , frame ) = cap . read ( ) #NEWLINE# frame_out = filter_func ( frame ) #NEWLINE# cv2 . imshow ( 'Press any key to exit' , filter_func ) #NEWLINE# key_code = cv2 . waitKey ( 10 ) #NEWLINE# #UNINDENT# cap . release ( ) #NEWLINE# cv2 . destroyAllWindows ( )