#N canvas 64 85 1339 660 10; #X obj 977 55 cnv 15 220 70 empty empty empty 20 12 0 14 -195568 -66577 0; #N canvas 189 149 454 304 gemwin 0; #X obj 130 218 gemwin; #X obj 67 89 outlet; #X obj 67 10 inlet; #X obj 67 41 route create; #X msg 67 70 set destroy; #X msg 182 68 set create; #X msg 129 165 create \, 1; #X msg 205 166 destroy; #N canvas 87 154 363 340 Gem.init 0; #X obj 112 15 loadbang; #X msg 62 93 reset; #X obj 49 135 outlet; #X msg 107 89 dimen 320 240; #X obj 107 51 t b b b; #X connect 0 0 4 0; #X connect 1 0 2 0; #X connect 3 0 2 0; #X connect 4 0 3 0; #X connect 4 2 1 0; #X restore 289 80 pd Gem.init; #X obj 128 109 t b b b; #X msg 247 137 frame 25; #X msg 156 138 dimen 640 480; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 3 0 9 0; #X connect 3 1 5 0; #X connect 3 1 7 0; #X connect 4 0 1 0; #X connect 5 0 1 0; #X connect 6 0 0 0; #X connect 7 0 0 0; #X connect 9 0 6 0; #X connect 9 1 11 0; #X connect 9 2 10 0; #X connect 10 0 0 0; #X connect 11 0 0 0; #X restore 984 101 pd gemwin; #X msg 984 80 create; #X text 987 62 Create window and render; #X text 979 189 with a great help from Mateu Batle & Alberto de Rodrigo from the iBit foundation.; #X text 978 153 the main purpose of this object is to calculate the average direction and the intensity of the movement in a video stream. ; #X text 979 213 comments to ydegoyon@gmail.com; #X text 979 137 pix_opencv_of_bm : Block Matching optical flow algorithm. ; #X obj 426 308 cnv 15 600 350 empty empty empty 20 12 0 14 -24198 -66577 0; #X obj 455 540 pix_opencv_of_bm; #X obj 560 572 unpack f f; #X floatatom 646 572 5 0 0 0 - - -, f 5; #X floatatom 648 592 5 0 0 0 - - -, f 5; #X text 688 571 largest amplitude of movement; #X text 688 592 angle of the block with the maximum movement; #X text 686 604 ( in degrees [-180 \, 180]); #X floatatom 507 621 5 0 0 0 - - -, f 5; #X text 549 642 marked with a white arrow on the stream; #X text 549 618 average angle of the blocks movement; #X text 548 630 ( in degrees [-180 \, 180]); #X obj 600 463 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X msg 515 461 nightmode \$1; #X floatatom 573 332 5 0 0 0 - - -, f 5; #X msg 463 331 blocksize \$1 \$1; #X floatatom 585 355 5 0 0 0 - - -, f 5; #X floatatom 599 381 5 0 0 0 - - -, f 5; #X msg 475 354 shiftsize \$1 \$1; #X msg 489 380 maxrange \$1 \$1; #X floatatom 589 408 5 0 0 0 - - -, f 5; #X msg 502 406 threshold \$1; #X obj 621 492 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X msg 521 491 useprevious \$1; #X text 614 332 set blocksize (width height) ( default 20x20 ); #X text 625 354 set shiftsize (width height) ( default 20x20 ); #X text 639 381 set maxrange (width height) ( default 20x10 ); #X text 643 490 use previous results ( default : 0 \, surprising results when on ); #X msg 505 435 minblocks \$1; #X floatatom 592 436 5 0 0 0 - - -, f 5; #X text 619 464 set nightmode; #X text 636 430 minimum nuber of blocks to detect the movement; #X text 631 405 threshold value for the detection of movement ( default 10 ); #X text 633 443 ( default 10 ); #X obj 507 -62 gemhead; #X obj 454 228 separator; #X obj 561 -62 bng 25 250 50 0 load empty empty 0 -6 0 8 -262144 -1 -1; #X obj 618 113 bng 15 250 50 0 empty empty end_reached 20 7 0 10 -262144 -1 -1; #X floatatom 600 78 5 0 10000 1 frame# - -, f 5; #X obj 561 -33 openpanel; #X msg 561 -13 open \$1; #X obj 549 96 pix_film; #X msg 567 30 auto \$1; #X obj 567 12 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 ; #X msg 662 13 colorspace RGBA; #X msg 767 13 colorspace RGB; #X msg 871 13 colorspace Grey; #X obj 662 -15 loadbang; #X obj 296 224 separator; #X obj 296 250 translateXYZ -2 0 0; #X obj 454 253 translateXYZ 2 0 0; #N canvas 0 50 450 300 vswitch 0; #X obj 144 263 outlet; #X obj 36 26 inlet; #X obj 260 29 inlet; #X obj 36 133 spigot; #X obj 260 141 spigot; #X obj 119 64 loadbang; #X msg 83 93 0; #X msg 113 93 1; #X msg 296 104 0; #X msg 326 104 1; #X obj 399 34 inlet; #X obj 399 67 select 0; #X connect 1 0 3 0; #X connect 2 0 4 0; #X connect 3 0 0 0; #X connect 4 0 0 0; #X connect 5 0 7 0; #X connect 5 0 8 0; #X connect 6 0 3 1; #X connect 7 0 3 1; #X connect 8 0 4 1; #X connect 9 0 4 1; #X connect 10 0 11 0; #X connect 11 0 7 0; #X connect 11 0 8 0; #X connect 11 1 9 0; #X connect 11 1 6 0; #X restore 385 125 pd vswitch; #X obj 453 125 tgl 15 0 empty load empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 312 94 pix_video; #X obj 315 -64 gemhead; #X msg 351 19 device 0; #X msg 360 50 driver 1; #X msg 337 -35 dialog; #X msg 342 -5 device /dev/dv1394-0; #X obj 294 659 pix_texture; #X obj 294 687 square 2; #X obj 455 664 pix_texture; #X text 504 146 this object can work on small frames unless you have a very powerful machine; #X obj 456 688 square 2; #X obj 295 201 pix_separator; #X obj 454 205 pix_separator; #X obj 384 154 pix_resize 320 240; #X obj 386 180 pix_rgba; #X connect 1 0 2 0; #X connect 2 0 1 0; #X connect 9 0 69 0; #X connect 9 1 16 0; #X connect 9 2 10 0; #X connect 10 0 11 0; #X connect 10 1 12 0; #X connect 20 0 21 0; #X connect 21 0 9 0; #X connect 22 0 23 0; #X connect 23 0 9 0; #X connect 24 0 26 0; #X connect 25 0 27 0; #X connect 26 0 9 0; #X connect 27 0 9 0; #X connect 28 0 29 0; #X connect 29 0 9 0; #X connect 30 0 31 0; #X connect 31 0 9 0; #X connect 36 0 9 0; #X connect 37 0 36 0; #X connect 42 0 49 0; #X connect 43 0 58 0; #X connect 44 0 47 0; #X connect 45 0 46 0; #X connect 46 0 49 1; #X connect 47 0 48 0; #X connect 48 0 49 0; #X connect 49 0 59 1; #X connect 49 2 45 0; #X connect 50 0 49 0; #X connect 51 0 50 0; #X connect 52 0 49 0; #X connect 52 0 61 0; #X connect 53 0 49 0; #X connect 54 0 49 0; #X connect 55 0 52 0; #X connect 55 0 51 0; #X connect 56 0 57 0; #X connect 57 0 67 0; #X connect 58 0 9 0; #X connect 59 0 74 0; #X connect 60 0 59 2; #X connect 61 0 59 0; #X connect 62 0 61 0; #X connect 63 0 61 0; #X connect 64 0 61 0; #X connect 65 0 61 0; #X connect 66 0 61 0; #X connect 67 0 68 0; #X connect 69 0 71 0; #X connect 72 0 56 0; #X connect 73 0 43 0; #X connect 74 0 75 0; #X connect 75 0 72 0; #X connect 75 0 73 0;