#N canvas 280 61 632 502 10; #X declare -lib Gem; #X text 442 8 GEM object; #X obj 8 277 cnv 15 430 210 empty empty empty 20 12 0 14 -233017 -66577 0; #X text 39 277 Inlets:; #X text 42 451 Outlets:; #X obj 8 241 cnv 15 430 30 empty empty empty 20 12 0 14 -195568 -66577 0; #X text 17 240 Arguments:; #X obj 8 56 cnv 15 430 180 empty empty empty 20 12 0 14 -233017 -66577 0; #X obj 449 77 cnv 15 170 320 empty empty empty 20 12 0 14 -228992 -66577 0; #X text 453 60 Example:; #X obj 518 410 cnv 15 100 60 empty empty empty 20 12 0 14 -195568 -66577 0; #N canvas 0 22 450 300 gemwin 0; #X obj 132 136 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 142 68 set create; #X msg 132 112 create \, 1; #X msg 198 112 destroy; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 3 0 6 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 restore 523 449 pd gemwin; #X msg 523 430 destroy; #X text 515 409 Create window:; #X obj 451 160 cnv 15 160 175 empty empty empty 20 12 0 14 -24198 -66577 0; #X obj 451 119 gemhead; #X obj 496 101 bng 15 250 50 0 empty empty pix_load 20 8 0 8 -262144 -1 -1; #X obj 451 345 pix_texture; #X text 63 251 ; #X text 18 465 Outlet 1: gemlist; #X text 15 291 Inlet 1: gemlist; #X obj 451 373 square 3; #X obj 546 120 gemhead; #X obj 591 102 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; #X text 16 432 Inlet 2: gemlist; #X text 71 31 Class: pix mix object; #X text 50 12 Synopsis: [pix_chroma_key]; #X text 29 57 Description: mix 2 images based on their color; #X obj 451 313 pix_chroma_key; #X msg 486 290 direction \$1; #X obj 486 270 tgl 15 1 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X text 16 390 Inlet 1: direction 0|1 : which stream is the key-source (0=left stream \; 1 = right stream); #X floatatom 465 178 5 0 255 0 - - -; #X floatatom 475 230 5 0 255 0 - - -; #X text 37 197 The 2 images have to be of the same size.; #X text 14 76 [pix_chroma_key] does compositing using pixel by pixel comparisons on two video streams. the comparison is based on user a user supplied RGB or YUV pixel value and +/- range. if the pixel in the key source lies within the range \, then it is replaced by the corresponding pixel im the other stream. typically this is most effective on a static background like a green/blue screen \, but can be effective when used with other GEM objects like pix_background for live video processing.; #X text 15 306 Inlet 1: value : list of 3 floats of the pixel-value to key out: values are either Red/Green/Blue (in RGBA-Space) or Y(luma)/U(Cb)/V(Cr) in YUV-Space; #X text 16 346 Inlet 1: range : list of 3 floats defining the +/-range of the key: values are either Red/Green/Blue (in RGBA-Space) or Y(luma)/U(Cb)/V(Cr) in YUV-Space; #X obj 478 216 hsl 128 12 0 1 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X obj 468 163 hsl 128 12 0 1 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X msg 465 195 value \$1 \$1 \$1; #X msg 475 248 range \$1 \$1 \$1; #N canvas 0 22 587 366 image 0; #X obj 77 48 inlet; #X obj 77 344 outlet; #X obj 223 55 inlet; #X msg 223 123 open \$1; #X obj 223 100 openpanel; #X obj 77 212 pix_yuv; #X text 133 214 we really want YUV; #X obj 77 174 pix_image examples/data/dancer.JPG; #X connect 0 0 7 0; #X connect 2 0 4 0; #X connect 3 0 7 0; #X connect 4 0 3 0; #X connect 5 0 1 0; #X connect 7 0 5 0; #X restore 451 138 pd image; #X text 449 77 open two different images; #N canvas 0 22 587 366 image 0; #X obj 77 28 inlet; #X obj 77 344 outlet; #X obj 223 35 inlet; #X msg 223 103 open \$1; #X obj 223 80 openpanel; #X obj 77 301 pix_buf; #X msg 103 277 auto 1; #X obj 103 256 loadbang; #X text 166 263 [pix_buf] with auto 1 is important if we want to recalculate our pix-effect each frame but don't want to reload the image all the time.; #X obj 77 230 pix_yuv; #X obj 77 185 pix_image examples/data/fractal.JPG; #X connect 0 0 10 0; #X connect 2 0 4 0; #X connect 3 0 10 0; #X connect 4 0 3 0; #X connect 5 0 1 0; #X connect 6 0 5 0; #X connect 7 0 6 0; #X connect 9 0 5 0; #X connect 10 0 9 0; #X restore 546 139 pd image; #X text 37 215 RGB values are 0-1 \, YUV values are 16/255-239/255 ; #X obj 508 8 declare -lib Gem; #X connect 10 0 11 0; #X connect 11 0 10 0; #X connect 14 0 41 0; #X connect 15 0 41 1; #X connect 16 0 20 0; #X connect 21 0 43 0; #X connect 22 0 43 1; #X connect 27 0 16 0; #X connect 28 0 27 0; #X connect 29 0 28 0; #X connect 31 0 39 0; #X connect 32 0 40 0; #X connect 37 0 32 0; #X connect 38 0 31 0; #X connect 39 0 27 0; #X connect 40 0 27 0; #X connect 41 0 27 0; #X connect 43 0 27 1;