Forums > Jitter

Frame by Frame Video analysis

June 10, 2006 | 4:28 pm

Hi Im trying to figure out how to create a patch that analyses every 10 FPS for any color disturbaces coming from a stationary video camera input.

Ex. Trying to monitor motion in a space with a ceiling mounted video camera where the patch first recognizes a presence by color disturbance, and then recognizes then that disturbance STOPS moving in the monitored environment.

If anyone could help me with this it would be greatly appreciated. Thanks.


June 11, 2006 | 10:53 am

here is a simple one. it uses cv.jit and jit.m3
it outputs center of mass, direction of general motion and on/off
there is anybody in the area. it can be expanded.
look into the cv.jit library as it is full of examples and possibilities.

as before. computer vision happens between the environment (light and
lens) and the code. a webcam is easy and cheap but lacks wide lenses,
manual control over whitebalnace and infrared capabilities (search for
"webcam infra" in google, which makes it easier to control light).

simple vision solutions (like this one) are VERY site specific , don’t
expect a setup to work outofbox in diffrent locations. calibration and
testing is a must. beware of changing light environment, windows and
even projection can change your light conditions. (infra is blind to
projected video but very sensitive to sunlight).

goodluck and enjoy

max v2;
#N vpatcher 15 55 878 776;
#P origin 42 12;
#P window setfont "Sans Serif" 12.;
#P window linecount 1;
#P comment 125 24 328 9109516 change init to clean mask , you can add
a median filter also;
#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P comment 566 709 110 9109513 Institute of Advanced Media Arts & Sciences;
#B frgb 15 2 2;
#P window linecount 1;
#P comment 566 694 110 9109513 support:;
#B frgb 15 2 2;
#P window linecount 3;
#P user com 564 638 113 9109513 30;
#K set 0 25209 8266 25953 28205 19809 29283 8272 25964 27749 29801
25970 3434 28016 16489 24941 24947 11873 25390 27248 3395 28528 31090
26983 26740 8361 12848 12339 11570 12336 13312;
#K end;
#P user panel 557 631 136 110;
#X brgb 198 198 198;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 12.;
#P window linecount 1;
#P comment 197 106 126 9109516 uses cv.jit;
#P comment 197 87 248 9109516 u may need to change vdeivce for ur camera;
#P toggle 329 255 15 0;
#P window setfont "Sans Serif" 9.;
#P message 363 305 44 9109513 set none;
#P newex 329 274 27 9109513 t b i;
#P newex 329 305 27 9109513 + 1;
#P newex 377 368 40 9109513 switch;
#P newex 11 81 48 9109513 jit.change;
#P newex 329 230 29 9109513 == 0.;
#P newex 427 261 27 9109513 r tog;
#P newex 292 579 29 9109513 s tog;
#P newex 428 285 41 9109513 togedge;
#P message 466 307 42 9109513 set right;
#P message 424 307 38 9109513 set left;
#P window setfont "Sans Serif" 36.;
#P message 378 393 87 9109540 none;
#P window setfont "Sans Serif" 9.;
#P newex 321 528 59 9109513 slide 10. 10.;
#P newex 259 528 59 9109513 slide 10. 10.;
#P newex 259 495 48 9109513 * 100000.;
#P newex 321 494 48 9109513 * 100000.;
#P newex 292 553 27 9109513 >;
#P newex 254 462 82 9109513 unpack 0. 0. 0. 0.;
#P newex 240 437 53 9109513 jit.3m;
#B color 5;
#P user jit.fpsgui 117 780 60 9109513 0;
#P number 175 422 35 9 1 7 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 175 443 51 9109513 radius $1;
#P comment 222 624 54 9109513 Right: Red;
#P comment 131 624 59 9109513 Left: Green;
#P newex 117 508 65 9109513 cv.jit.LKflow;
#N vpatcher 10 100 603 528;
#P window setfont "Sans Serif" 9.;
#P newex 409 233 71 9109513 jit.op @op abs;
#P newex 165 234 71 9109513 jit.op @op abs;
#P newex 304 186 124 9109513 jit.clip @min -1. @max 1.;
#P newex 304 160 105 9109513 jit.op @op * @val 0.3;
#P newex 59 186 124 9109513 jit.clip @min -1. @max 1.;
#P newex 59 160 105 9109513 jit.op @op * @val 0.3;
#P newex 502 190 32 9109513 * -1.;
#N comlet (matrix) Vertical flow;
#P outlet 290 314 15 0;
#N comlet (matrix) Horizontal flow;
#P outlet 45 325 15 0;
#N comlet (float) threshold;
#P inlet 399 60 15 0;
#N comlet (matrix) Vertical flow;
#P inlet 304 60 15 0;
#N comlet (matrix) Horizontal flow;
#P inlet 59 60 15 0;
#P newex 258 190 32 9109513 * -1.;
#P flonum 399 92 35 9 0. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 154 92 35 9 0. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 290 262 53 9109513 jit.pack;
#P newex 409 213 103 9109513 jit.op @op

#P newex 304 213 103 9109513 jit.op @op >p @val 0.;
#P button 290 240 15 0;
#P newex 45 273 53 9109513 jit.pack;
#P newex 165 213 103 9109513 jit.op @op

#P newex 59 213 103 9109513 jit.op @op >p @val 0.;
#P button 45 251 15 0;
#P fasten 1 0 0 0 64 233 50 233;
#P connect 0 0 3 0;
#P connect 3 0 14 0;
#P connect 11 0 17 0;
#P connect 17 0 18 0;
#P connect 18 0 1 0;
#P connect 1 0 3 1;
#P fasten 21 0 3 2 170 259 78 259;
#P fasten 13 0 8 0 404 80 159 80;
#P connect 8 0 17 1;
#P fasten 18 0 2 0 64 208 170 208;
#P connect 2 0 21 0;
#P connect 10 0 2 1;
#P fasten 5 0 4 0 309 233 295 233;
#P connect 4 0 7 0;
#P connect 7 0 15 0;
#P connect 12 0 19 0;
#P connect 19 0 20 0;
#P connect 20 0 5 0;
#P connect 5 0 7 1;
#P fasten 5 0 7 2 309 247 323 247;
#P fasten 22 0 7 3 414 255 337 255;
#P connect 13 0 9 0;
#P connect 9 0 19 1;
#P fasten 20 0 6 0 309 207 414 207;
#P connect 6 0 22 0;
#P connect 16 0 6 1;
#P pop;
#P newobj 117 575 61 9109513 p visualizer;
#P user jit.pwindow 116 640 162 122 0 1 0 0 1 0;
#P newex 117 539 61 9109513 jit.unpack 2;
#P comment 174 607 103 9109513 Horizontal movement;
#B frgb 255 255 255;
#P user panel 108 602 179 167;
#X brgb 140 140 140;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 24.;
#P number 69 24 52 24 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 40 22 15 0;
#P toggle 13 24 15 0;
#P user pictslider 37 252 162 121 4 4 4 4 SliderDefaultKnob.pct 1
SliderDefaultBkgnd.pct 1 3187 0 0 7864480 1. 1.;
#P user multiSlider 203 252 93 121 0. 1500. 1 3176 15 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P window setfont "Sans Serif" 9.;
#P flonum 204 226 53 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 269 229 31 9109513 Mass;
#P newex 189 198 78 9109513 cv.jit.centroids;
#P user panel 197 219 108 30;
#X brgb 210 210 195;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#N vpatcher 25 70 625 470;
#P origin 0 -7;
#P inlet 240 293 15 0;
#P outlet 152 360 15 0;
#N comlet metro start;
#P inlet 85 21 15 0;
#N comlet bang for reste image;
#P inlet 114 21 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 66 184 54 9109513 delay 1111;
#P button 114 41 15 0;
#P newex 115 58 40 9109513 t b 1 b;
#P newex 89 156 56 9109513 jit.rgb2luma;
#P newex 166 248 74 9109513 sel exportimage;
#P window setfont "Sans Serif" 24.;
#P number 286 301 52 24 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P newex 155 334 96 9109513 jit.op @op > @val 150;
#P message 271 82 121 9109513 read wall320240.png , bang;
#P newex 271 103 55 9109513 jit.qt.movie;
#P user jit.pwindow 49 248 82 62 0 1 0 0 1 0;
#P message 61 206 107 9109513 exportimage wall320240;
#P newex 50 226 126 9109513 jit.matrix foo 4 char 160 120;
#P newex 155 312 126 9109513 jit.op @op absdiff @val 100;
#P message 136 103 28 9109513 open;
#P toggle 87 85 15 0;
#P newex 88 103 45 9109513 qmetro 2;
#P newex 89 125 139 9109513 jit.dx.grab 160 120 @vdevice 0;
#P window setfont "Sans Serif" 36.;
#P window linecount 3;
#P comment 296 148 129 9109540 create clean matte;
#P fasten 14 0 6 0 55 175;
#P connect 7 0 6 0;
#P connect 6 0 8 0;
#P connect 17 0 7 0;
#P fasten 15 0 17 0 120 80 71 80;
#P connect 19 0 3 0;
#P fasten 15 1 3 0 135 83 92 83;
#P connect 3 0 2 0;
#P connect 4 0 1 0;
#P connect 2 0 1 0;
#P connect 1 0 14 0;
#P connect 18 0 16 0;
#P connect 16 0 15 0;
#P connect 15 2 4 0;
#P connect 11 0 20 0;
#P fasten 14 0 5 0 160 175;
#P connect 5 0 11 0;
#P connect 6 1 13 0;
#P connect 21 0 11 1;
#P connect 12 0 11 1;
#P fasten 13 0 10 0 171 270 251 270 251 74 276 74;
#P connect 10 0 9 0;
#P connect 9 0 5 1;
#P pop;
#P newobj 11 59 43 9109513 p starter;
#P user jit.pwindow 21 111 162 122 0 1 0 0 1 0;
#P window setfont "Sans Serif" 12.;
#P window linecount 2;
#P comment 69 62 122 9109516 start metro , and bang to create new mask;
#P user panel 65 59 130 40;
#X brgb 255 244 75;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P connect 10 0 3 0;
#P connect 3 0 38 0;
#P connect 38 0 2 0;
#P connect 11 0 3 1;
#P fasten 5 0 9 0 194 237 42 237;
#P connect 12 0 3 2;
#P fasten 38 0 18 0 16 406 122 406;
#P fasten 21 0 18 0 180 482 122 482;
#P connect 18 0 15 0;
#P connect 15 0 17 0;
#P fasten 17 0 16 0 122 629 122 629;
#P connect 16 0 23 0;
#P connect 15 1 17 1;
#P connect 22 0 21 0;
#P fasten 38 0 5 0 16 103 194 103;
#P fasten 7 0 8 0 209 254 208 254;
#P connect 5 1 7 0;
#P fasten 17 0 24 0 122 598 229 598 229 431 245 431;
#P connect 24 1 25 0;
#P connect 25 1 28 0;
#P connect 28 0 29 0;
#P connect 29 0 26 0;
#P fasten 26 0 35 0 297 576 297 576;
#P connect 30 0 26 1;
#P connect 25 2 27 0;
#P connect 27 0 30 0;
#P fasten 5 1 37 0 228 216 334 216;
#P connect 37 0 43 0;
#P connect 43 0 41 0;
#P connect 41 1 40 0;
#P fasten 41 0 42 0 334 300 368 300;
#P connect 40 0 39 0;
#P connect 39 0 31 0;
#P connect 33 0 39 1;
#P connect 32 0 39 1;
#P connect 42 0 39 2;
#P connect 34 0 32 0;
#P connect 36 0 34 0;
#P connect 34 1 33 0;
#P pop;


June 11, 2006 | 11:00 am

there is nothing simple about the LK or centroids block, only in the
patch wacking ;)


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