<s> import cv2 <EOL> from webcam_gui import webcam_gui <EOL> def imgproc ( frame ) : <EOL> gray = cv2 . cvtColor ( frame , cv2 . COLOR_BGR2GRAY ) <EOL> cv2 . imshow ( '<STR_LIT>' , gray ) <EOL> blur = cv2 . blur ( gray , ( <NUM_LIT:5> , <NUM_LIT:5> ) ) <EOL> edge = cv2 . Canny ( blur , <NUM_LIT:30> , <NUM_LIT:100> ) <EOL> edge = cv2 . blur ( edge , ( <NUM_LIT:2> , <NUM_LIT:2> ) ) <EOL> cv2 . imshow ( '<STR_LIT>' , edge ) <EOL> thresh1 , thresh = cv2 . threshold ( edge , <NUM_LIT> , <NUM_LIT:255> , cv2 . THRESH_BINARY ) <EOL> cv2 . imshow ( '<STR_LIT>' , thresh ) <EOL> contours , hry = cv2 . findContours ( thresh , cv2 . RETR_TREE , cv2 . CHAIN_APPROX_SIMPLE ) <EOL> cpframe = frame . copy ( ) <EOL> cv2 . drawContours ( cpframe , contours , - <NUM_LIT:1> , ( <NUM_LIT:0> , <NUM_LIT:255> , <NUM_LIT:0> ) , <NUM_LIT:3> ) <EOL> cv2 . imshow ( '<STR_LIT>' , cpframe ) <EOL> contours = [ ctr for ctr in contours if cv2 . contourArea ( ctr ) > <NUM_LIT:100> ] <EOL> contours = [ cv2 . approxPolyDP ( ctr , <NUM_LIT:5> , True ) for ctr in contours ] <EOL> contours = [ ctr for ctr in contours if cv2 . isContourConvex ( ctr ) ] <EOL> cv2 . drawContours ( frame , contours , - <NUM_LIT:1> , ( <NUM_LIT:0> , <NUM_LIT:255> , <NUM_LIT:0> ) , <NUM_LIT:3> ) <EOL> return frame <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> webcam_gui ( imgproc , video_src = <NUM_LIT:1> ) </s>
