hi,
it works when i use the Buffer mode of the remember function
(remember(1)

But when i try to "blob detect", the background substraction is really noisy (bottom image on the left :
http://mcnaze.free.fr/Capture.png)
there is the code
-------------------------------------------------------------------
import hypermedia.video.*;
import codeanticode.gsvideo.*;
OpenCV opencv;
GSPipeline pipe;
int w = 320;
int h = 240;
int threshold = 80;
boolean find=true;
PFont font;
void setup() {
size( w*2+30, h*2+30);
pipe = new GSPipeline(this, "gnomevfssrc location=http://Admin:123456@192.168.0.100/cgi-bin/cmd/system?GET_STREAM ! jpegdec ! ffmpegcolorspace ! video/x-raw-rgb, width=640, height=480, bpp=32, depth=24");
opencv = new OpenCV( this );
opencv.allocate(640, 480);
font = loadFont( "AndaleMono.vlw" );
textFont( font );
println( "Drag mouse inside sketch window to change threshold" );
println( "Press space bar to record background image" );
}
void draw() {
background(0);
opencv.read();
if (pipe.available()){
pipe.read();
opencv.copy(pipe, 0, 0, 640, 480, 0, 0, 320, 240);
image( opencv.image(), 10, 10 );
image( opencv.image(), 20+w, 10 );
image( opencv.image(OpenCV.MEMORY), 10, 20+h );
opencv.threshold(threshold);
opencv.absDiff();
image( opencv.image(OpenCV.GRAY), 20+w, 20+h ); // absolute difference image
// working with blobs
Blob[] blobs = opencv.blobs( 100, w*h/3, 20, true );
noFill();
pushMatrix();
translate(20+w,20+h);
for( int i=0; i<blobs.length; i++ ) {
Rectangle bounding_rect = blobs[i].rectangle;
float area = blobs[i].area;
float circumference = blobs[i].length;
Point centroid = blobs[i].centroid;
Point[] points = blobs[i].points;
// rectangle
noFill();
stroke( blobs[i].isHole ? 128 : 64 );
rect( bounding_rect.x, bounding_rect.y, bounding_rect.width, bounding_rect.height );
// centroid
stroke(0,0,255);
line( centroid.x-5, centroid.y, centroid.x+5, centroid.y );
line( centroid.x, centroid.y-5, centroid.x, centroid.y+5 );
noStroke();
fill(0,0,255);
text( area,centroid.x+5, centroid.y+5 );
fill(255,0,255,64);
stroke(255,0,255);
if ( points.length>0 ) {
beginShape();
for( int j=0; j<points.length; j++ ) {
vertex( points[j].x, points[j].y );
}
endShape(CLOSE);
}
noStroke();
fill(255,0,255);
text( circumference, centroid.x+5, centroid.y+15 );
}
popMatrix();
}
}
void keyPressed() {
if ( key==' ' ) opencv.remember(1);
}
void mouseDragged() {
threshold = int( map(mouseX,0,width,0,255) );
}
public void stop() {
opencv.stop();
super.stop();
}
Is there a solution, or another way to blobtrack with GsVideo.
Thanks a lot for your help