def render_deepdreamvideo(): import cv print("CV is working") cap = cv.VideoCapture('SampleFile.mkv') while (cap.isOpened()): ret, frame = cap.read() gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY) cv.imshow('frame', gray) if cv.waitKey(1) & 0xFF == ord('q'): break cap.release() cv.destroyAllWindows()
video = cv.VideoCapture(0) background=0 for i in range(30): ret,background=video.read() background=np.flip(background, axis=1m) while True: ret,img=video.read() img=np.flip(img, axis=1) hsv=cv.cvtColor(img, cv.COLOR_BGR2HSV) blur=cv.GaussianBlur(hsv, (35,35), 0) cv.imshow("Display", img) lower=np.array([0,120,70]) upper=np.array([10,255,255]) mask01=cv.inRange(hsv, lower, upper) cv.imshow("Background", background) cv.imshow("mask01", mask01) k=cv.waitKey(1) if k==ord('q'): break video.release() cv.destroyAllWindows()
import cv, cv2 img = cv.imread("cones_plus_shadowed_barrel.jpg", cv2.CV_LOAD_IMAGE_COLOR) cv.namedWindow('Normal Image') cv.imshow('Normal Image', img) hsv_img = img cv.CvtColor(img,hsv_img,cv.CV_RGB2HSV) cv.namedWindow('HSV Image') cv.imshow('HSV Image', hsv_img) cv.waitKey(0) cv.destroyAllWindows()