Forums > Jitter

Background Substitution with cv.jit

June 11, 2008 | 6:00 pm

I am trying to do background substitution on a live video feed using cv.jit. I recall that past versions of the cv.jit package included a background_substitution patch or help file but it appears to have been removed. If anyone can provide me with a simple patch that does this I would be very appreciative.
Thanks!
Aaron


June 11, 2008 | 9:36 pm

don’t know if it could help you.

max v2;
#N vpatcher 191 44 1354 850;
#P origin 0 53;
#P toggle 203 10 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 278 76 29 196617 stop;
#P message 244 76 33 196617 start;
#P newex 244 56 41 196617 sel 1 0;
#P newex 203 33 37 196617 metro;
#P newex 203 98 167 196617 jit.qt.movie 320 240 @autostart 0;
#P message 322 49 76 196617 read bball.mov;
#P window linecount 4;
#P message 671 74 309 196617 ; max launchbrowser http://www.cycling74.com/forums/index.php?t=msg&th=18120&start=0&rid=3975&S=643946d7c907891c0a8fb507052ed420;
#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 fasten 47 0 8 0 208 122 41 122;
#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 connect 52 0 48 0;
#P connect 48 0 47 0;
#P fasten 46 0 47 0 327 94 208 94;
#P fasten 50 0 47 0 249 92 208 92;
#P fasten 51 0 47 0 283 92 208 92;
#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 52 0 49 0 208 30 249 30;
#P connect 49 0 50 0;
#P fasten 49 1 51 0 264 74 283 74;
#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;


June 11, 2008 | 10:23 pm

Thanks Kyred!
I was able to get that to run in both the Max 4.6 and Max 5.02 runtime applications. However, when I tried to use the full Max 5.02 application (I’m in demo mode for now) the patch loads but does not work properly. Only the top right pwindow object displays any video. Do you know if there are issues using cv.jit with the new version of Max? Could it be happening because I am in demo mode?
Cheers,
Aaron


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