Following Max's advice on using an image (i'm using a tif file) stored
on disk to "reset" pix_background - i'm having difficulty getting
pix_background to respond to the still image.
I've created an example in the attached file - which involves the
following steps (please see the numbered comments in the patch):
1. Choose the camera/input device number
2. load a still image
3. Display the still image in the open Gem window
4. Store the image (attempt to) in pix_background with "reset" message
(if you attempt to remove background now, nothing happens)
5. Display video stream in Gem window
6. Remove background
The result is that the still image appears not to have been stored. What
is stored is the first moment (frame?) of the live video, when it is
first displayed in step 5.
It seems like pix_background doesn't respond to still images. Do you
need to convert the pix_image output to some sort of "video stream"? If
so, how is done?
Will paste the patch below in case the attachment doesn't arrive.
Thanks - happy Easter!
Iain
#N canvas 541 183 872 614 10;
#X obj 62 237 cnv 15 100 60 empty empty empty 20 12 0 14 -195568 -66577
0;
#N canvas 1 58 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 obj 189 -61 loadbang;
#X msg 188 -38 create;
#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 connect 8 0 9 0;
#X connect 9 0 3 0;
#X restore 67 277 pd gemwin;
#X msg 67 257 destroy;
#X obj 451 233 pix_texture;
#X obj 451 255 square 3;
#X msg 402 165 reset;
#X text 598 188 threshold;
#X obj 451 207 pix_background;
#X msg 577 173 \$1 \$1 \$1;
#X msg 574 101 0.5;
#X floatatom 577 157 5 0 0 0 - - -;
#X obj 395 86 pix_video;
#X obj 201 165 switch 2;
#X msg 149 36 1;
#X msg 302 67 2;
#X msg 640 133 0;
#X obj 360 -93 gemhead 261;
#X obj 174 94 t f b b;
#X obj 38 27 pix_image;
#X obj 304 -104 gemhead;
#X obj 7 -115 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#N canvas 0 0 450 300 openpanel 0;
#X obj 114 62 inlet;
#X obj 121 254 outlet;
#X obj 114 125 openpanel;
#X msg 114 162 set open \$1;
#X obj 114 199 t b a;
#X connect 0 0 2 0;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 4 0 1 0;
#X connect 4 1 1 0;
#X restore 7 -94 pd openpanel;
#X msg 6 -66
open /home/iain/projects/espelho/pd/background_stills/teste_low00000.tif
;
#X msg 557 -52 device 1;
#N canvas 166 121 570 420 device 0;
#X obj 204 60 cnv 20 20 20 empty \$0-open-canvas 1 4 10 0 16 -233017
-1 0;
#X obj 60 61 hradio 18 1 0 8 empty empty empty 0 -6 0 8 -225271 -1
-1 1;
#X obj 60 13 inlet;
#X msg 160 254 label \$1;
#X obj 160 232 makefilename %d;
#X obj 60 108 int;
#X obj 60 337 outlet;
#X obj 160 277 send \$0-open-canvas;
#X msg 130 170 device \$1;
#X obj 60 130 t b f;
#X obj 130 192 t a a;
#X obj 130 298 list prepend set;
#X obj 130 320 list trim;
#X obj 160 211 route device;
#X obj 130 116 loadbang;
#X msg 130 138 0;
#X connect 1 0 5 0;
#X connect 2 0 1 0;
#X connect 3 0 7 0;
#X connect 4 0 3 0;
#X connect 5 0 9 0;
#X connect 8 0 10 0;
#X connect 9 0 6 0;
#X connect 9 1 8 0;
#X connect 10 0 11 0;
#X connect 10 1 13 0;
#X connect 11 0 12 0;
#X connect 12 0 6 0;
#X connect 13 0 4 0;
#X connect 14 0 15 0;
#X connect 15 0 8 0;
#X coords 0 -1 1 1 165 20 1 60 60;
#X restore 557 -76 pd device;
#X text 371 147 4 Store image in pix_background;
#X obj 279 2 loadbang;
#X text 28 -115 2 Load still image;
#X text 556 74 6 Remove background;
#X text 563 -97 1 Select camera/device;
#X text 63 236 comment;
#X text 136 17 3 Display still image;
#X text 302 44 5 Display video stream;
#X connect 1 0 2 0;
#X connect 2 0 1 0;
#X connect 3 0 4 0;
#X connect 5 0 7 0;
#X connect 7 0 3 0;
#X connect 8 0 7 1;
#X connect 9 0 10 0;
#X connect 10 0 8 0;
#X connect 11 0 12 2;
#X connect 12 0 7 0;
#X connect 13 0 17 0;
#X connect 14 0 12 0;
#X connect 15 0 7 1;
#X connect 17 0 12 0;
#X connect 17 1 22 0;
#X connect 17 2 15 0;
#X connect 18 0 12 1;
#X connect 19 0 11 0;
#X connect 19 0 18 0;
#X connect 20 0 21 0;
#X connect 21 0 22 0;
#X connect 22 0 18 0;
#X connect 23 0 11 0;
#X connect 24 0 23 0;
#X connect 26 0 14 0;