Created
January 3, 2021 20:45
-
-
Save ricklon/655ccbd53f09b2fa33873df5503fbdbf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import the opencv library | |
import cv2 | |
import numpy as np | |
import matplotlib | |
from matplotlib import colors | |
from matplotlib import pyplot as plt | |
print(cv2.__version__) | |
vid = cv2.VideoCapture(1) | |
while(True): | |
ret, frame = vid.read() | |
frame = cv2.GaussianBlur(frame, (7,7),0) | |
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) | |
min_red = np.array([0, 100, 80]) | |
max_red = np.array([10, 256, 256]) | |
frame = cv2.inRange(frame, min_red, max_red) | |
cv2.imshow('frame', frame) | |
if cv2.waitKey(1) & 0xFF == ord('q'): | |
break | |
vid.release() | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment