Skip to content

Instantly share code, notes, and snippets.

@ricklon
Created January 3, 2021 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricklon/655ccbd53f09b2fa33873df5503fbdbf to your computer and use it in GitHub Desktop.
Save ricklon/655ccbd53f09b2fa33873df5503fbdbf to your computer and use it in GitHub Desktop.
# 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