Created
February 5, 2018 13:30
-
-
Save TheVisualG/f56c6348a25dc3b1eb584d10269d040c to your computer and use it in GitHub Desktop.
bg_test
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 gab.opencv.*; | |
import processing.video.*; | |
Movie video; | |
OpenCV opencv; | |
void setup() { | |
size(1440, 1080); | |
video = new Movie(this, "test2.mov"); | |
opencv = new OpenCV(this, 1440, 1080); | |
opencv.startBackgroundSubtraction(5, 3, 0.5); | |
video.loop(); | |
video.play(); | |
} | |
void draw() { | |
image(video, 1440, 1080); | |
opencv.loadImage(video); | |
opencv.updateBackground(); | |
opencv.dilate(); | |
opencv.erode(); | |
noFill(); | |
stroke(255, 0, 0); | |
strokeWeight(3); | |
for (Contour contour : opencv.findContours()) { | |
contour.draw(); | |
} | |
} | |
void movieEvent(Movie m) { | |
m.read(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment