back again:
I'm doing another test toggling between a pix_video and a pix_film input to pix_background. Independently, both function well with pix_background, the "reset" message stores an image and all subsequent changes to that image stream are displayed against a black background. If I toggle between the streams with "switch" however, pix_background seems to re-store the 1st frame of the stream after the switch is made.
Is there any way around this? ie. can I use the stored image of one stream (live video for example) in the background removal of another (eg. mpeg playback)?
The still image issue is another problem... Because ultimately, I wish to use a still image (pix_image) in the background removal of pix_video.
Hope someone is out there this easter - i'm stuck!
Cheers,
Iain
On Fri, 2012-04-06 at 10:50 -0300, Iain Mott wrote:
pix_background's lack of response to the still image was a gemhead numbering issue i think. The new file attached does store the still-image in pix_background.
I should explain that the image I'm using is a tif photo taken from a webcam with no one sitting in front. When testing the live video - i'm sitting in front of the camera and the aim is to remove the background.
In the attached file i'm using the following sequence:
- Choose the camera/input device number
- load a still image
- Display the still image in the open Gem window
- Store the image in pix_background with "reset" message
- Remove background (screen goes blank as it should)
- Display the live video
As i mentioned while testing the live video I am sitting in front of the camera against the same background of the still image. What I can't understand is why isn't the background of this removed? What seems to happen is that the first frame of the live video is stored when I switch the input of pix_background to the live feed (step 6) - the previous stored version of the still image seems to be deleted when the switch is made.
How can I remove the background?
Thanks,
Iain
#N canvas 546 84 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 407 74 pix_video; #X obj 206 171 switch 2; #X msg 149 36 1; #X msg 302 67 2; #X msg 640 119 0; #X obj 174 94 t f b b; #X msg 66 -64 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 66 -88 pd device; #X obj 279 2 loadbang; #X text 72 -109 1 Select camera/device; #X text 63 236 comment; #X text 136 17 3 Display still image; #X obj 41 2 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1 ; #N canvas 0 0 587 366 image 0; #X obj 77 48 inlet; #X obj 77 344 outlet; #X obj 77 205 pix_image ../../doc/gem/examples/data/fractal.JPG; #X obj 223 55 inlet; #X msg 223 123 open $1; #X obj 223 100 openpanel; #X obj 77 281 pix_buf; #X msg 103 257 auto 1; #X obj 103 236 loadbang; #X text 156 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 connect 0 0 2 0; #X connect 2 0 6 0; #X connect 3 0 5 0; #X connect 4 0 2 0; #X connect 5 0 4 0; #X connect 6 0 1 0; #X connect 7 0 6 0; #X connect 8 0 7 0; #X restore -38 32 pd image; #X obj 406 -41 gemhead 66; #X obj -38 3 gemhead 1; #X text 371 147 4 Store image in pix_background; #X text 572 79 5 Remove background; #X text 310 46 6 Display video stream; #X text 37 -20 2 Load still image; #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 16 0; #X connect 14 0 12 0; #X connect 15 0 7 1; #X connect 16 0 12 0; #X connect 17 0 11 0; #X connect 18 0 17 0; #X connect 19 0 14 0; #X connect 23 0 24 1; #X connect 24 0 12 1; #X connect 25 0 11 0; #X connect 26 0 24 0;
On Fri, 2012-04-06 at 08:17 -0300, Iain Mott wrote:
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):
- Choose the camera/input device number
- load a still image
- Display the still image in the open Gem window
- 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;
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list