My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members

CbModel Library

CbModel is a library for motion detection based on the paper: " Background Modeling and Subtraction by Codebook Construction", by L. Davis et. al. (International Conference on Image Processing, ICIP 2004).

What I need to use CbModel library?

CbModel is a library for the Processing programming environment, implemented by following these guidelines. The library can be use without limitation from any Java program as well.

Supported Plattform

CbModel is operating system independent,tested on Ubuntu platform with Processing 1.0.3

Documentation

Links Wiki's pages

  • Installation page(view)
  • Download javadocs package(here)

Examples

Simple example program that analyzes a video (using video library GSMovie) and finds the foreground pixels. It uses 50 frames to build the background model and use the remaining frame for shows the image "difference" (pixel contains white / blacks that indicate the pixel foreground to background, respectively):

import codeanticode.gsvideo.*;
import it.ppm.codebookmodel.*;

GSMovie myMovie;
CbModel Model;
int 	frame=0;
PFont Font;
	
void setup() {
  size(385,630, P3D);	
  background(200);
  Font = loadFont("/home/federico/bin/processing-1.0.3/examples/3D/Typography/Typing/data/Univers45.vlw");
  textFont(Font, 15); 
  myMovie=new GSMovie(this, "/home/federico/Scrivania/ppm/video/walk1.mpg");
  Model=new CbModel(this,384,288);
  print(Model.getVersion());
  fill(0); 
  text("frame:", 0, 310);		
  myMovie.loop();
}

void draw(){
  fill(200);
  rect(50,295,40,15);
  fill(0);
  text(frame, 50, 310);
  if(frame<50){
    if (myMovie.available()) {
      frame=frame+1;   
      myMovie.read();
      image(myMovie, 0,0);
      try{
        Model.updateModel(myMovie);
      }
      catch(LearningStateException Err){
	println("Impossible to pass the state 'test' to the state of 'learning'...");
      }
      catch(WrongSizeException Err){
	println("Dimension of input's image not equal to the size set in the model...");
      }
    }
  }	 
  else{  
    Model.setTestState();
    if(Model.isTestState()){
      if(myMovie.available()){
        frame=frame+1;   
        myMovie.read();
        image(myMovie, 0,0);
        try{
          image(Model.getDifferenceImage(myMovie),0,320);
        }
        catch(WrongSizeException Err){
          println("Dimension");
        }
        catch(LearningStateException Err){
          println("Learn");
        }
      }
    }
  }
}

Applications

Forward there are 3 programs to test the library (to set the parameters) in different scenarios:

Filename Use Download
App_Codebook for local video (here)
Webcam_Codebook for the stream webcam (here)
Streaming_Codebook for the internet video stream (here)

Release

CbModel 0.1 is now available.
You can obtain this release (Here) and follow these instructions to build it.

License

CbModel is released under the LGPLv3 license.

Credit

CbModel has been developed by Federico Bartoli under
the supervision of Dr. Walter Nunziati
for examining "Multimedia programming and design" held by professor Alberto Del Bimbo

Contat

e-mail: bert1987@libero.it
Powered by Google Project Hosting