Created
December 12, 2019 13:50
-
-
Save habakan/bd1b351ece75a6ce578400419fccc4fd to your computer and use it in GitHub Desktop.
subtract_background
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 cv2 | |
def main(): | |
cap = cv2.VideoCapture(0) | |
bgObj = cv2.bgsegm.createBackgroundSubtractorMOG() | |
while(True): | |
ret, frame = cap.read() | |
fgmask = bgObj.apply(frame) | |
cv2.imshow('frame',fgmask) | |
if cv2.waitKey(1) & 0xFF == ord('q'): | |
break | |
cap.release() | |
cv2.destroyAllWindows() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment