aaaa
ah
`import cv2` `import numpy as np` `from time import time` `cap = cv2.VideoCapture(0)` `while True:` `t1 = time()` `_ , frame = cap.read()` `frame2hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)` `lower_color = np.array([75,130,10])` `upper_color = np.array([125,240,140])` `mask = cv2.inRange(frame2hsv,lower_color,upper_color)` `res = cv2.bitwise_and(frame, frame, mask = mask)` `blur = cv2.GaussianBlur(res,(15,15),0)` `cv2.imshow('Gaussian Blurring',blur)` `median = cv2.medianBlur(res,15)` `cv2.imshow('Median Blur',median)` `bilateral = cv2.bilateralFilter(res,15,75,75)` `cv2.imshow('bilateral Blur',bilateral)` `cv2.imshow("frame", frame )` `cv2.imshow("mask", mask )` `cv2.imshow("res", res )` `if cv2.waitKey(1) != -1:` `break` `t2=time()` print(t2-t1) cap.release() cv2.destroyAllWindows()
d