Forums > Jitter

Background substraction on a webcam

February 6, 2006 | 10:37 am

hello,
I’m a student starting with Jitter, and i need some help.. I’m trying to substract the color of the background on a webcam to insert the forground on another movies. I use the example "10jChromakey" to start, but i can’t select the color (blue) on the image of the webcam.
Can someone help me?
Thanks
Greg


February 6, 2006 | 10:56 am

Hi Greg,
You need the cv library to that, here is sample patch :

max v2;
#N vpatcher 204 101 1367 978;
#P origin 0 53;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 604 733 71 196617 fsmenubar $1;
#P toggle 604 714 15 0;
#P toggle 513 713 15 0;
#P message 513 734 69 196617 fullscreen $1;
#P newex 513 690 35 196617 sel 27;
#P newex 513 664 40 196617 key;
#P newex 380 804 78 196617 jit.window test;
#P number 612 242 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 472 475 74 196617 jit.op @op *;
#P newex 472 452 64 196617 jit.matrix in;
#P newex 472 430 74 196617 t b l;
#P newex 472 399 59 196617 jit.op @op !;
#P newex 472 379 128 196617 jit.matrix 1 char 320 240;
#P newex 472 352 131 196617 cv.jit.label @threshold 600;
#P user jit.pwindow 657 525 162 122 0 1 0 0 1 0;
#P newex 472 331 59 196617 jit.op @op !;
#P user jit.pwindow 471 527 162 122 0 1 0 0 1 0;
#P newex 472 302 128 196617 jit.matrix 1 char 320 340;
#P newex 472 281 135 196617 cv.jit.label @threshold 1000;
#P newex 472 244 105 196617 jit.op @op > @val 125;
#P newex 472 221 145 196617 jit.fastblur @range 3 @mode 4;
#P newex 36 185 66 196617 jit.unpack;
#P newex 36 163 178 196617 jit.colorspace @input rgb @output YIQ;
#P user jit.pwindow 215 516 162 122 0 1 0 0 1 0;
#P newex 472 200 128 196617 jit.matrix 1 char 320 240;
#P newex 309 421 101 196617 jit.op @op * @val 2.;
#P newex 216 444 103 196617 jit.op @op >;
#P newex 29 337 65 196617 cv.jit.stddev;
#P newex 64 214 141 196617 jit.matrix 1 float32 320 240;
#P newex 216 388 85 196617 jit.op @op absdiff;
#P toggle 151 244 15 0;
#P newex 29 266 27 196617 + 1;
#P newex 29 287 45 196617 gate 2 1;
#P user jit.pwindow 422 40 162 122 0 1 0 0 1 0;
#P message 195 242 32 196617 reset;
#P user jit.pwindow 28 516 162 122 0 1 0 0 1 0;
#P newex 36 129 139 196617 jit.matrix in 4 char 320 240;
#P message 107 90 44 196617 settings;
#P comment 58 36 105 196617 Use live camera input;
#P message 120 59 31 196617 close;
#P message 89 59 28 196617 open;
#P toggle 36 35 15 0;
#P newex 36 59 49 196617 qmetro 2;
#P newex 36 89 54 196617 jit.qt.grab;
#P user panel 28 24 162 94;
#X brgb 140 140 140;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P fasten 14 0 13 0 156 264 34 264;
#P connect 13 0 12 0;
#P connect 12 0 17 0;
#P fasten 10 0 17 0 200 317 34 317;
#P fasten 17 1 9 0 89 374 34 374;
#P connect 3 0 2 0;
#P fasten 5 0 1 0 125 81 41 81;
#P fasten 4 0 1 0 94 81 41 81;
#P connect 2 0 1 0;
#P hidden connect 7 0 1 0;
#P connect 1 0 8 0;
#P connect 8 0 22 0;
#P connect 22 0 23 0;
#P connect 23 2 16 0;
#P connect 16 0 12 1;
#P fasten 12 1 15 0 69 309 274 309 274 374 221 374;
#P lcolor 8;
#P connect 15 0 18 0;
#P connect 18 0 21 0;
#P fasten 17 1 15 1 89 374 296 374;
#P lcolor 13;
#P fasten 17 0 19 0 34 369 314 369;
#P lcolor 14;
#P connect 19 0 18 1;
#P connect 36 0 38 0;
#P connect 41 0 38 0;
#P connect 44 0 38 0;
#P fasten 8 0 11 0 41 149 401 149 401 23 428 23;
#P fasten 18 0 20 0 221 474 440 474 440 197 477 197;
#P connect 20 0 24 0;
#P connect 24 0 25 0;
#P connect 25 0 26 0;
#P connect 26 0 27 0;
#P connect 27 0 29 0;
#P connect 29 0 31 0;
#P connect 31 0 32 0;
#P connect 32 0 33 0;
#P connect 33 0 34 0;
#P connect 34 0 35 0;
#P connect 35 0 36 0;
#P connect 36 0 28 0;
#P fasten 39 0 40 0 518 685 518 685;
#P connect 40 0 42 0;
#P connect 42 0 41 0;
#P connect 34 1 36 1;
#P connect 37 0 25 1;
#P lcolor 1;
#P fasten 40 0 43 0 518 710 609 710;
#P connect 43 0 44 0;
#P fasten 33 0 30 0 477 421 663 421;
#P pop;

bnjmn


February 6, 2006 | 4:00 pm



juc
April 13, 2008 | 9:37 pm

Hi,

I would need such patch, but it’s impossble to paste this, maybe it’s too old or I don’t know. Actually I downloaded the cv.jit plugin, but I have no idea how to do any kind of background substraction. I have the basic pacth how to substract a person from the still backgorund->now I have a person with black bg, and I would be very happy to find any solution how to make it transparent…
Thax for any help!



EMV
April 20, 2008 | 4:27 pm



EMV
April 20, 2008 | 4:33 pm

Wow, the patch by recyclism actually works great! I first assumed it was a standard patch that came with cv, but it surely isn’t.

This is an excellent starting point to continue development of my body-pose tracking app.


Viewing 6 posts - 1 through 6 (of 6 total)