first commit
This commit is contained in:
22
bgsub_test.py
Normal file
22
bgsub_test.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from __future__ import print_function
|
||||
import cv2 as cv
|
||||
|
||||
|
||||
# backSub = cv.createBackgroundSubtractorMOG2()
|
||||
backSub = cv.createBackgroundSubtractorKNN()
|
||||
|
||||
capture = cv.VideoCapture(0)
|
||||
|
||||
while True:
|
||||
ret, frame = capture.read()
|
||||
if frame is None:
|
||||
break
|
||||
|
||||
fgMask = backSub.apply(frame)
|
||||
|
||||
cv.imshow('Frame', frame)
|
||||
cv.imshow('FG Mask', fgMask)
|
||||
|
||||
keyboard = cv.waitKey(30)
|
||||
if keyboard == 'q' or keyboard == 27:
|
||||
break
|
||||
Reference in New Issue
Block a user