public static void main(String[] args) throws Exception {
CanvasFrame frame = new CanvasFrame("Track");
OpenCVFrameGrabber grabber = OpenCVFrameGrabber.createDefault("../track/Balcony4_Vis.mpg");
grabber.start();
BackgroundSubtractorMOG backsub = new BackgroundSubtractorMOG();
CvMemStorage storage = CvMemStorage.create();
while(true) {
IplImage img = grabber.grab();
IplImage fgmask = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1);
backsub.apply(img, fgmask, 0.01);
CvSeq contours = new CvSeq();
cvFindContours(fgmask, storage, contours, Loader.sizeof(CvContour.class), CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
while(contours != null && !contours.isNull()) {
CvRect box = cvBoundingRect(contours, 0);