import numpy as np import cv2 import cv cap = cv2.VideoCapture(0) # take first frame of the video ret,frame = cap.read() clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8)) while(1): ret ,frame = cap.read() if ret == True: hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) cl1 = clahe.apply(hsv) # print track_window cv2.imshow('frame',hsv) cv2.imshow('clahe',cl1) k = cv2.waitKey(60) & 0xff if k == 27: break else: cv2.imwrite(chr(k)+".jpg",cl1) else: break cv2.destroyAllWindows() cap.release()