From c8914c3217d54862370902fd36b1f8496cea7c51 Mon Sep 17 00:00:00 2001 From: "N.N." Date: Thu, 17 Sep 2009 17:04:10 +0000 Subject: P.i.D.i.P. version 0.12.24 (see CHANGES.LOG) svn path=/trunk/externals/pidip/; revision=12385 --- CHANGES.LOG | 4 + configure.ac | 2 +- doc/pdp_binary-help.pd | 270 +++++++++++++++++++++++++++++++++++++---------- doc/pdp_cmap-help.pd | 38 ++++--- doc/pdp_compose-help.pd | 12 ++- doc/pdp_ctrack-help.pd | 64 ++++++----- doc/pdp_ieee1394-help.pd | 2 +- doc/pdp_shape-help.pd | 92 ++++++++-------- doc/pdp_v4l2-help.pd | 2 +- modules/pdp_binary.c | 67 +++++++++--- modules/pdp_cmap.c | 11 +- 11 files changed, 391 insertions(+), 173 deletions(-) diff --git a/CHANGES.LOG b/CHANGES.LOG index d0b5286..b73f4c3 100644 --- a/CHANGES.LOG +++ b/CHANGES.LOG @@ -1,3 +1,7 @@ +0.12.24 ( codename Baltanik ) + fixed color selection bugs and help patches + in pdp_binary, pdp_ctrack, pdp_cmap, pdp_shape, pdp_compose + 0.12.23 ( codename My Mum's Cam ) added pdp_v4l2 : video 4 linux 2 object code template from pdp_v4l and xawtv ( v4l2 driver ), diff --git a/configure.ac b/configure.ac index 89fc9c7..76af1fe 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT AC_CANONICAL_HOST AC_CONFIG_HEADER(include/pidip_config.h) -PDP_PIDIP_VERSION="0.12.23" +PDP_PIDIP_VERSION="0.12.24" PD_DIR=/usr/local/pd PDP_DIR=/usr/local/pd/pdp FFMPEG_SOURCE_DIR=/SOURCES/ffmpeg diff --git a/doc/pdp_binary-help.pd b/doc/pdp_binary-help.pd index f74c13c..58b062d 100644 --- a/doc/pdp_binary-help.pd +++ b/doc/pdp_binary-help.pd @@ -1,97 +1,257 @@ -#N canvas 416 0 781 666 10; +#N canvas 76 103 922 722 10; #X obj 342 90 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; #X msg 197 162 loop \$1; -#X obj 198 140 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 +#X obj 198 140 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1 1; #X msg 444 70 open \$1; #X obj 443 46 openpanel; #X obj 428 29 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; -#X floatatom 390 125 5 0 0 0 - - -; +#X floatatom 431 145 5 0 0 0 - - -; #X msg 299 91 stop; -#X obj 397 94 hsl 300 15 0 1000 0 0 empty empty empty -2 -6 0 8 -262144 +#X obj 440 116 hsl 300 15 0 5000 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X obj 331 161 metro 70; #X obj 326 193 pdp_yqt; -#X obj 26 263 pdp_v4l; -#X obj 35 232 metro 70; -#X obj 80 198 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +#X obj 55 105 pdp_v4l; +#X obj 64 74 metro 70; +#X obj 109 40 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; -#X msg 37 199 stop; -#X msg 122 230 open /dev/video; -#X floatatom 303 338 5 0 0 0 - - -; -#X floatatom 312 359 5 0 0 0 - - -; -#X floatatom 329 380 5 0 0 0 - - -; -#X floatatom 334 402 5 0 0 0 - - -; -#X text 296 631 written by Yves Degoyon ( ydegoyon@free.fr ); -#X floatatom 343 427 5 0 0 0 - - -; -#X text 382 401 X coordinate of cursor ( pick ); -#X text 391 426 Y coordinate of cursor ( pick ); -#X msg 89 341 pick; -#X text 57 323 Pick up the color; -#X floatatom 356 450 5 0 0 0 - - -; +#X msg 66 41 stop; +#X msg 151 72 open /dev/video; +#X floatatom 313 407 5 0 0 0 - - -; +#X floatatom 322 428 5 0 0 0 - - -; +#X floatatom 339 449 5 0 0 0 - - -; +#X floatatom 282 332 5 0 0 0 - - -; +#X text 70 697 written by Yves Degoyon ( ydegoyon@free.fr ); +#X floatatom 291 357 5 0 0 0 - - -; +#X msg 133 382 pick; +#X text 134 399 Pick up the color; +#X floatatom 304 380 5 0 0 0 - - -; #X obj 594 197 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X obj 594 249 pdp_control; #X msg 594 222 thread \$1; #X floatatom 594 310 5 0 0 0 - - -; #X obj 594 281 route pdp_drop; -#X msg 118 379 setcur \$1 \$2; -#X text 6 378 Set the cursor; +#X text 187 291 Set the cursor; #X floatatom 155 524 5 0 0 0 - - -; #X floatatom 205 525 5 0 0 0 - - -; #X floatatom 252 524 5 0 0 0 - - -; -#X text 297 614 pdp_binary : image binarizer; -#X text 122 554 Components of selected color; +#X text 71 680 pdp_binary : image binarizer; +#X text 295 522 Components of selected color; #X text 167 542 Y; #X text 218 542 U; #X text 262 542 V; -#X text 402 449 Tolerance ( default = 55 ); -#X text 350 337 Y component ( default : 200 ); -#X text 357 358 U component ( default : -1 ); -#X text 374 379 V component ( default : -1 ); +#X text 350 379 Tolerance ( default = 55 ); +#X text 408 404 Y component ( default : 200 ); #X obj 110 459 pdp_binary ----; -#X obj 312 264 pdp_glx; #X obj 311 290 route press drag release; #X msg 335 234 cursor 1; -#X obj 78 504 pdp_glx; +#X obj 575 609 unpack f f f; +#X obj 356 404 r y; +#X obj 362 426 r u; +#X obj 382 449 r v; +#X obj 573 636 s y; +#X obj 615 662 s u; +#X obj 652 661 s v; +#X obj 571 475 pdp_colorgrid pdp_colorgrid1 256 0 256 50 0 50 0 1 1 +10 10 647 500; +#X obj 574 557 pack f f f; +#X obj 134 359 del 100; +#X msg 135 321 bang; +#X msg 102 289 setcur \$1 \$2; +#X text 331 331 set X coordinate of cursor; +#X text 339 356 set Y coordinate of cursor; +#X text 418 426 U component ( default : -1 = ignore ); +#X text 432 446 V component ( default : -1 = ignore ); +#N canvas 5 49 450 300 rgb2yuv 0; +#N canvas 286 158 450 300 rgb2y 0; +#X obj 82 57 inlet; +#X obj 82 236 outlet; +#X obj 82 119 * 65.738; +#X obj 143 120 * 129.075; +#X obj 215 119 * 25.064; +#X obj 82 142 +; +#X obj 82 164 +; +#X obj 82 207 + 16; +#X obj 82 186 / 256; +#X obj 143 57 inlet; +#X obj 215 57 inlet; +#X connect 0 0 2 0; +#X connect 2 0 5 0; +#X connect 3 0 5 1; +#X connect 4 0 6 1; +#X connect 5 0 6 0; +#X connect 6 0 8 0; +#X connect 7 0 1 0; +#X connect 8 0 7 0; +#X connect 9 0 3 0; +#X connect 10 0 4 0; +#X restore 103 206 pd rgb2y; +#N canvas 286 158 450 300 rgb2u 0; +#X obj 82 57 inlet; +#X obj 82 236 outlet; +#X obj 82 142 +; +#X obj 82 164 +; +#X obj 82 186 / 256; +#X obj 82 119 * -37.945; +#X obj 143 120 * -74.494; +#X obj 215 119 * 112.439; +#X obj 82 207 + 128; +#X obj 143 57 inlet; +#X obj 215 57 inlet; +#X connect 0 0 5 0; +#X connect 2 0 3 0; +#X connect 3 0 4 0; +#X connect 4 0 8 0; +#X connect 5 0 2 0; +#X connect 6 0 2 1; +#X connect 7 0 3 1; +#X connect 8 0 1 0; +#X connect 9 0 6 0; +#X connect 10 0 7 0; +#X restore 163 206 pd rgb2u; +#N canvas 286 158 450 300 rgb2v 0; +#X obj 82 57 inlet; +#X obj 82 236 outlet; +#X obj 82 142 +; +#X obj 82 164 +; +#X obj 82 186 / 256; +#X obj 82 207 + 128; +#X obj 82 119 * 112.439; +#X obj 143 120 * -94.154; +#X obj 215 119 * -18.285; +#X obj 143 57 inlet; +#X obj 215 57 inlet; +#X connect 0 0 6 0; +#X connect 2 0 3 0; +#X connect 3 0 4 0; +#X connect 4 0 5 0; +#X connect 5 0 1 0; +#X connect 6 0 2 0; +#X connect 7 0 2 1; +#X connect 8 0 3 1; +#X connect 9 0 7 0; +#X connect 10 0 8 0; +#X restore 224 207 pd rgb2v; +#X text 106 37 convert RGB to YUV; +#X obj 103 245 pack 0 0 0; +#X obj 103 69 inlet RGB; +#X obj 103 104 pack \$1 \$2 \$3; +#X obj 103 353 outlet YUV; +#X obj 103 226 / 256; +#X obj 163 226 / 256; +#X obj 224 226 / 256; +#X obj 103 125 unpack 0 0 0; +#X obj 103 166 t f f f; +#X obj 103 146 * 256; +#X obj 136 146 * 256; +#X obj 170 146 * 256; +#X connect 0 0 8 0; +#X connect 1 0 9 0; +#X connect 2 0 10 0; +#X connect 4 0 7 0; +#X connect 5 0 6 0; +#X connect 6 0 11 0; +#X connect 8 0 4 0; +#X connect 9 0 4 1; +#X connect 10 0 4 2; +#X connect 11 0 13 0; +#X connect 11 1 14 0; +#X connect 11 2 15 0; +#X connect 12 0 0 0; +#X connect 12 1 1 0; +#X connect 12 2 2 0; +#X connect 13 0 12 0; +#X connect 14 0 0 1; +#X connect 14 0 1 1; +#X connect 14 0 2 1; +#X connect 15 0 2 2; +#X connect 15 0 1 2; +#X connect 15 0 0 2; +#X restore 575 582 pd rgb2yuv; +#X text 653 585 imported from gem : thanks iohannes; +#X floatatom 537 536 5 0 0 0 - - -; +#X floatatom 691 542 5 0 0 0 - - -; +#X floatatom 816 543 5 0 0 0 - - -; +#X obj 650 635 + 128; +#X obj 612 635 + 128; +#X obj 154 608 yuv2rgb; +#X obj 252 560 - 128; +#X obj 204 560 - 128; +#X obj 154 584 pack f f f; +#X obj 154 632 unpack f f f; +#X floatatom 155 657 5 0 0 0 - - -; +#X floatatom 195 658 5 0 0 0 - - -; +#X floatatom 239 658 5 0 0 0 - - -; +#X obj 79 505 pdp_glx; +#X obj 312 264 pdp_glx; #X connect 0 0 9 0; #X connect 1 0 10 0; #X connect 2 0 1 0; #X connect 3 0 10 0; #X connect 4 0 3 0; #X connect 5 0 4 0; -#X connect 6 0 9 1; +#X connect 6 0 10 1; #X connect 7 0 9 0; #X connect 8 0 6 0; #X connect 9 0 10 0; -#X connect 10 0 46 0; -#X connect 10 0 47 0; -#X connect 10 0 49 0; -#X connect 11 0 46 0; -#X connect 11 0 47 0; +#X connect 10 0 41 0; +#X connect 10 0 43 0; +#X connect 10 0 76 0; +#X connect 11 0 41 0; +#X connect 11 0 76 0; #X connect 12 0 11 0; #X connect 13 0 12 0; #X connect 14 0 12 0; #X connect 15 0 11 0; -#X connect 16 0 46 1; -#X connect 17 0 46 2; -#X connect 18 0 46 3; -#X connect 19 0 46 4; -#X connect 21 0 46 5; -#X connect 24 0 46 0; -#X connect 26 0 46 6; -#X connect 27 0 29 0; -#X connect 28 0 31 0; +#X connect 16 0 41 1; +#X connect 17 0 41 2; +#X connect 18 0 41 3; +#X connect 19 0 41 4; +#X connect 21 0 41 5; +#X connect 22 0 41 0; +#X connect 24 0 41 6; +#X connect 25 0 27 0; +#X connect 26 0 29 0; +#X connect 27 0 26 0; #X connect 29 0 28 0; -#X connect 31 0 30 0; -#X connect 32 0 24 0; -#X connect 32 0 46 0; -#X connect 46 0 50 0; -#X connect 46 1 34 0; -#X connect 46 2 35 0; -#X connect 46 3 36 0; -#X connect 47 0 48 0; -#X connect 48 0 32 0; -#X connect 49 0 47 0; +#X connect 31 0 70 0; +#X connect 32 0 69 0; +#X connect 33 0 68 0; +#X connect 41 0 75 0; +#X connect 41 1 31 0; +#X connect 41 2 32 0; +#X connect 41 3 33 0; +#X connect 42 0 55 0; +#X connect 43 0 76 0; +#X connect 44 0 48 0; +#X connect 44 1 66 0; +#X connect 44 2 65 0; +#X connect 45 0 16 0; +#X connect 46 0 17 0; +#X connect 47 0 18 0; +#X connect 51 0 52 0; +#X connect 51 0 62 0; +#X connect 51 1 52 1; +#X connect 51 1 63 0; +#X connect 51 2 52 2; +#X connect 51 2 64 0; +#X connect 52 0 60 0; +#X connect 53 0 22 0; +#X connect 54 0 53 0; +#X connect 55 0 41 0; +#X connect 55 0 54 0; +#X connect 60 0 44 0; +#X connect 65 0 50 0; +#X connect 66 0 49 0; +#X connect 67 0 71 0; +#X connect 68 0 70 2; +#X connect 69 0 70 1; +#X connect 70 0 67 0; +#X connect 71 0 72 0; +#X connect 71 1 73 0; +#X connect 71 2 74 0; +#X connect 76 0 42 0; diff --git a/doc/pdp_cmap-help.pd b/doc/pdp_cmap-help.pd index 0a73ba1..ef79f1d 100644 --- a/doc/pdp_cmap-help.pd +++ b/doc/pdp_cmap-help.pd @@ -1,4 +1,4 @@ -#N canvas 137 28 781 666 10; +#N canvas 137 84 781 666 10; #X obj 32 596 pdp_glx; #X obj 268 64 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; @@ -9,9 +9,9 @@ #X obj 369 20 openpanel; #X obj 354 3 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; -#X floatatom 316 99 5 0 0; +#X floatatom 330 152 5 0 0 0 - - -; #X msg 225 65 stop; -#X obj 323 68 hsl 300 15 0 1000 0 0 empty empty empty -2 -6 0 8 -262144 +#X obj 337 121 hsl 300 15 0 1000 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X obj 257 135 metro 70; #X obj 252 167 pdp_yqt; @@ -21,14 +21,14 @@ -1; #X msg 37 199 stop; #X msg 122 230 open /dev/video; -#X floatatom 253 369 5 0 0; -#X floatatom 262 390 5 0 0; -#X floatatom 270 414 5 0 0; -#X floatatom 228 321 5 0 0; +#X floatatom 253 369 5 0 0 0 - - -; +#X floatatom 262 390 5 0 0 0 - - -; +#X floatatom 270 414 5 0 0 0 - - -; +#X floatatom 228 321 5 0 0 0 - - -; #X text 346 633 written by Yves Degoyon ( ydegoyon@free.fr ); -#X floatatom 237 345 5 0 0; -#X msg 93 382 pick; -#X floatatom 282 438 5 0 0; +#X floatatom 237 345 5 0 0 0 - - -; +#X msg 108 473 pick; +#X floatatom 282 438 5 0 0 0 - - -; #X msg 293 466 luminosity \$1; #X obj 394 468 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; @@ -54,12 +54,12 @@ #X msg 318 538 delete \$1; #X text 440 540 Delete a mapping; #X msg 341 565 resize 20; -#X floatatom 393 540 5 0 0; +#X floatatom 393 540 5 0 0 0 - - -; #X obj 669 329 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X obj 669 381 pdp_control; #X msg 669 354 thread \$1; -#X floatatom 669 442 5 0 0; +#X floatatom 669 442 5 0 0 0 - - -; #X obj 669 413 route pdp_drop; #X msg 82 596 cursor \$1; #X obj 157 597 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 @@ -68,15 +68,18 @@ #X text 425 566 Resize the color table; #X text 371 514 Clear the color table; #X text 1 422 Set the cursor; -#X msg 105 422 setcur \$1 \$2; -#X connect 0 0 59 0; +#X msg 94 387 setcur \$1 \$2; +#X obj 33 627 route press drag release; +#X msg 107 419 bang; +#X obj 107 446 del 100; +#X connect 0 0 60 0; #X connect 1 0 10 0; #X connect 2 0 11 0; #X connect 3 0 2 0; #X connect 4 0 11 0; #X connect 5 0 4 0; #X connect 6 0 5 0; -#X connect 7 0 10 1; +#X connect 7 0 11 1; #X connect 8 0 10 0; #X connect 9 0 7 0; #X connect 10 0 11 0; @@ -110,4 +113,7 @@ #X connect 53 0 0 0; #X connect 54 0 53 0; #X connect 59 0 31 0; -#X connect 59 0 23 0; +#X connect 59 0 61 0; +#X connect 60 0 59 0; +#X connect 61 0 62 0; +#X connect 62 0 23 0; diff --git a/doc/pdp_compose-help.pd b/doc/pdp_compose-help.pd index 94c5fb1..1ff75c2 100644 --- a/doc/pdp_compose-help.pd +++ b/doc/pdp_compose-help.pd @@ -1,4 +1,4 @@ -#N canvas 221 9 712 664 10; +#N canvas 226 49 712 664 10; #X obj 105 562 pdp_glx; #X obj 100 167 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; @@ -23,7 +23,7 @@ #X floatatom 299 360 5 0 0 0 - - -; #X text 336 338 X coordinate of cursor ( pick ); #X text 347 359 Y coordinate of cursor ( pick ); -#X msg 14 443 pick; +#X msg 34 489 pick; #X text 11 422 Pick up the color; #X floatatom 309 380 5 0 0 0 - - -; #X text 356 380 Tolerance ( default = 50 ); @@ -79,9 +79,11 @@ source; #X text 441 409 Use luminosity; #X text 424 435 Show the cursor; #X msg 155 561 cursor \$1; -#X obj 233 562 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +#X obj 233 562 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1; #X obj 16 517 route press; +#X obj 33 464 del 100; +#X msg 33 442 bang; #X connect 0 0 69 0; #X connect 1 0 8 0; #X connect 2 0 9 0; @@ -132,7 +134,9 @@ source; #X connect 61 0 62 0; #X connect 62 0 53 0; #X connect 63 0 53 0; -#X connect 63 0 21 0; +#X connect 63 0 71 0; #X connect 67 0 0 0; #X connect 68 0 67 0; #X connect 69 0 63 0; +#X connect 70 0 21 0; +#X connect 71 0 70 0; diff --git a/doc/pdp_ctrack-help.pd b/doc/pdp_ctrack-help.pd index caab8fe..4373804 100644 --- a/doc/pdp_ctrack-help.pd +++ b/doc/pdp_ctrack-help.pd @@ -1,34 +1,34 @@ -#N canvas 42 26 781 666 10; -#X obj 19 504 pdp_glx; +#N canvas 52 74 781 666 10; +#X obj 7 614 pdp_glx; #X obj 268 64 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; #X msg 123 136 loop \$1; -#X obj 124 114 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1 +#X obj 124 114 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1; #X msg 370 44 open \$1; #X obj 369 20 openpanel; #X obj 354 3 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; -#X floatatom 316 99 5 0 0 0 - - -; +#X floatatom 333 153 5 0 0 0 - - -; #X msg 225 65 stop; -#X obj 323 68 hsl 300 15 0 1000 0 0 empty empty empty -2 -6 0 8 -262144 +#X obj 340 122 hsl 300 15 0 1000 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X obj 257 135 metro 70; #X obj 252 167 pdp_yqt; -#X obj 26 263 pdp_v4l; -#X obj 35 232 metro 70; -#X obj 80 198 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +#X obj 14 107 pdp_v4l; +#X obj 23 76 metro 70; +#X obj 68 42 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; -#X msg 37 199 stop; -#X msg 122 230 open /dev/video; +#X msg 25 43 stop; +#X msg 110 74 open /dev/video; #X floatatom 244 273 5 0 0 0 - - -; #X floatatom 253 294 5 0 0 0 - - -; #X floatatom 270 315 5 0 0 0 - - -; #X floatatom 275 337 5 0 0 0 - - -; #X floatatom 164 496 5 0 0 0 - - -; #X floatatom 210 496 5 0 0 0 - - -; -#X text 294 592 written by Yves Degoyon ( ydegoyon@free.fr ); -#X text 295 575 pdp_ctrack : color tracker; +#X text 362 589 written by Yves Degoyon ( ydegoyon@free.fr ); +#X text 363 572 pdp_ctrack : color tracker; #X floatatom 123 516 5 0 0 0 - - -; #X floatatom 123 537 5 0 0 0 - - -; #X text 290 273 R component; @@ -37,8 +37,8 @@ #X floatatom 284 362 5 0 0 0 - - -; #X text 323 336 X coordinate of cursor ( pick ); #X text 332 361 Y coordinate of cursor ( pick ); -#X msg 89 341 pick; -#X text 57 323 Pick up the color; +#X msg 120 357 pick; +#X text 10 359 Pick up the color; #X floatatom 297 385 5 0 0 0 - - -; #X text 343 384 Tolerance ( default = 50 ); #X msg 312 411 luminosity \$1; @@ -65,27 +65,30 @@ #X msg 594 222 thread \$1; #X floatatom 594 310 5 0 0 0 - - -; #X obj 594 281 route pdp_drop; -#X msg 118 379 setcur \$1 \$2; -#X text 6 378 Set the cursor; -#X msg 7 425 cursor \$1; -#X obj 80 427 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 -; -#X floatatom 123 591 5 0 0 0 - - -; -#X floatatom 173 592 5 0 0 0 - - -; -#X floatatom 220 591 5 0 0 0 - - -; -#X text 139 624 Color components; -#X text 135 609 R; -#X text 186 609 G; -#X text 230 609 B; +#X msg 84 212 setcur \$1 \$2; +#X text 80 196 Set the cursor; +#X msg 52 614 cursor \$1; +#X obj 116 616 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom 218 612 5 0 0 0 - - -; +#X floatatom 268 613 5 0 0 0 - - -; +#X floatatom 315 612 5 0 0 0 - - -; +#X text 234 645 Color components; +#X text 230 630 R; +#X text 281 630 G; +#X text 325 630 B; #X obj 110 459 pdp_ctrack ----; -#X connect 0 0 55 0; +#X obj 7 646 route press drag release; +#X msg 108 249 bang; +#X obj 108 273 del 100; +#X connect 0 0 67 0; #X connect 1 0 10 0; #X connect 2 0 11 0; #X connect 3 0 2 0; #X connect 4 0 11 0; #X connect 5 0 4 0; #X connect 6 0 5 0; -#X connect 7 0 10 1; +#X connect 7 0 11 1; #X connect 8 0 10 0; #X connect 9 0 7 0; #X connect 10 0 11 0; @@ -114,8 +117,8 @@ #X connect 51 0 54 0; #X connect 52 0 51 0; #X connect 54 0 53 0; -#X connect 55 0 33 0; #X connect 55 0 66 0; +#X connect 55 0 68 0; #X connect 57 0 0 0; #X connect 58 0 57 0; #X connect 66 0 0 0; @@ -126,3 +129,6 @@ #X connect 66 5 59 0; #X connect 66 6 60 0; #X connect 66 7 61 0; +#X connect 67 0 55 0; +#X connect 68 0 69 0; +#X connect 69 0 33 0; diff --git a/doc/pdp_ieee1394-help.pd b/doc/pdp_ieee1394-help.pd index 4cf5ea7..efdb96d 100644 --- a/doc/pdp_ieee1394-help.pd +++ b/doc/pdp_ieee1394-help.pd @@ -50,7 +50,7 @@ capture object for linux; #X text 708 174 setting video standard; #X msg 638 197 norm SECAM; #X msg 639 221 norm NTSC; -#X obj 535 303 pdp_xv; +#X obj 535 303 pdp_glx; #X connect 0 0 26 0; #X connect 1 0 0 0; #X connect 2 0 0 0; diff --git a/doc/pdp_shape-help.pd b/doc/pdp_shape-help.pd index d2762cb..bf7c85c 100644 --- a/doc/pdp_shape-help.pd +++ b/doc/pdp_shape-help.pd @@ -1,8 +1,8 @@ -#N canvas 96 16 752 609 10; +#N canvas 391 142 752 609 10; #X obj 142 61 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; #X msg 34 125 loop \$1; -#X obj 35 103 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1 1 +#X obj 35 103 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1 ; #X msg 27 56 open \$1; #X obj 26 32 openpanel; @@ -14,12 +14,10 @@ -1 -1 0 1; #X obj 131 132 metro 70; #X obj 126 164 pdp_yqt; -#X obj 245 134 pdp_v4l; #X obj 254 104 metro 70; #X obj 299 70 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; #X msg 256 71 stop; -#X msg 341 102 open /dev/video; #X obj 567 476 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X obj 567 528 pdp_control; @@ -77,56 +75,58 @@ #X obj 421 382 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X text 442 382 Only show detected shape ( default = off ); +#X obj 245 134 pdp_v4l2; +#X msg 341 102 open /dev/video0; #X connect 0 0 9 0; #X connect 1 0 10 0; #X connect 2 0 1 0; #X connect 3 0 10 0; #X connect 4 0 3 0; #X connect 5 0 4 0; -#X connect 6 0 9 1; +#X connect 6 0 10 1; #X connect 7 0 9 0; #X connect 8 0 6 0; #X connect 9 0 10 0; -#X connect 10 0 58 0; -#X connect 11 0 58 0; +#X connect 10 0 56 0; +#X connect 11 0 66 0; #X connect 12 0 11 0; -#X connect 13 0 12 0; -#X connect 14 0 12 0; -#X connect 15 0 11 0; -#X connect 16 0 18 0; -#X connect 17 0 20 0; +#X connect 13 0 11 0; +#X connect 14 0 16 0; +#X connect 15 0 18 0; +#X connect 16 0 15 0; #X connect 18 0 17 0; -#X connect 20 0 19 0; -#X connect 22 0 33 0; -#X connect 23 0 58 0; -#X connect 24 0 23 0; -#X connect 25 0 24 0; -#X connect 27 0 32 0; -#X connect 28 0 30 0; -#X connect 30 0 24 0; -#X connect 30 1 24 2; -#X connect 32 0 24 0; -#X connect 32 1 24 1; -#X connect 33 0 34 0; -#X connect 33 2 36 0; -#X connect 34 0 58 0; -#X connect 36 0 58 0; -#X connect 38 0 58 0; -#X connect 39 0 38 0; -#X connect 43 0 58 0; -#X connect 44 0 43 0; -#X connect 55 0 56 0; -#X connect 56 0 58 0; -#X connect 58 0 22 0; -#X connect 58 1 46 0; -#X connect 58 2 47 0; -#X connect 58 3 48 0; -#X connect 58 4 49 0; -#X connect 59 0 22 0; -#X connect 60 0 61 0; -#X connect 61 0 58 0; -#X connect 63 0 64 0; -#X connect 64 0 55 0; -#X connect 64 0 60 0; -#X connect 65 0 58 0; -#X connect 66 0 65 0; +#X connect 20 0 31 0; +#X connect 21 0 56 0; +#X connect 22 0 21 0; +#X connect 23 0 22 0; +#X connect 25 0 30 0; +#X connect 26 0 28 0; +#X connect 28 0 22 0; +#X connect 28 1 22 2; +#X connect 30 0 22 0; +#X connect 30 1 22 1; +#X connect 31 0 32 0; +#X connect 31 2 34 0; +#X connect 32 0 56 0; +#X connect 34 0 56 0; +#X connect 36 0 56 0; +#X connect 37 0 36 0; +#X connect 41 0 56 0; +#X connect 42 0 41 0; +#X connect 53 0 54 0; +#X connect 54 0 56 0; +#X connect 56 0 20 0; +#X connect 56 1 44 0; +#X connect 56 2 45 0; +#X connect 56 3 46 0; +#X connect 56 4 47 0; +#X connect 57 0 20 0; +#X connect 58 0 59 0; +#X connect 59 0 56 0; +#X connect 61 0 62 0; +#X connect 62 0 53 0; +#X connect 62 0 58 0; +#X connect 63 0 56 0; +#X connect 64 0 63 0; +#X connect 66 0 56 0; +#X connect 67 0 66 0; diff --git a/doc/pdp_v4l2-help.pd b/doc/pdp_v4l2-help.pd index af298b6..6b0e599 100644 --- a/doc/pdp_v4l2-help.pd +++ b/doc/pdp_v4l2-help.pd @@ -36,7 +36,7 @@ recent cameras \, if it doesn't with yours report bugs to ydegoyon@free.fr #X text 297 81 see initialization phase for valid standards; #X floatatom 213 71 5 0 0 0 - - -; #X msg 213 91 standard \$1; -#X obj 96 300 pdp_xv; +#X obj 96 300 pdp_glx; #X msg 179 299 cursor 1; #X msg 167 271 posdim 0 0 1440 800; #X text 324 303 authors : Yves Degoyon and Lluis Gomez i Bigorda; diff --git a/modules/pdp_binary.c b/modules/pdp_binary.c index aba8a15..128336a 100644 --- a/modules/pdp_binary.c +++ b/modules/pdp_binary.c @@ -25,6 +25,7 @@ #include "yuv.h" #include #include +#include "g_canvas.h" static char *pdp_binary_version = "pdp_binary: a image binarizer version 0.1 written by Yves Degoyon (ydegoyon@free.fr)"; @@ -43,6 +44,9 @@ typedef struct pdp_binary_struct int x_colorY; // YUV components of binary mask int x_colorU; int x_colorV; + int x_colorR; // RGB components of binary mask + int x_colorG; + int x_colorB; int x_cursX; // X position of the cursor int x_cursY; // Y position of the cursor int x_tolerance; // tolerance @@ -53,8 +57,26 @@ typedef struct pdp_binary_struct t_outlet *x_U; // output U component of selected color t_outlet *x_V; // output V component of selected color + t_canvas *x_canvas; + } t_pdp_binary; +static void pdp_binary_draw_color(t_pdp_binary *x) +{ + int width, height; + char color[32]; + + sprintf( color, "#%.2X%.2X%.2X", x->x_colorR, x->x_colorG, x->x_colorB ); + width = rtext_width( glist_findrtext( (t_glist*)x->x_canvas, (t_text *)x ) ); + height = rtext_height( glist_findrtext( (t_glist*)x->x_canvas, (t_text *)x ) ); + sys_vgui(".x%x.c delete rectangle %xCOLOR\n", x->x_canvas, x ); + sys_vgui(".x%x.c create rectangle %d %d %d %d -fill %s -tags %xCOLOR\n", + x->x_canvas, x->x_obj.te_xpix+width+5, x->x_obj.te_ypix, + x->x_obj.te_xpix+width+height+5, + x->x_obj.te_ypix+height, color, x ); +} + + static void pdp_binary_setcur(t_pdp_binary *x, t_floatarg fpx, t_floatarg fpy ) { if ( (fpx>=0.0) && (fpx<=1.0) && (fpy>=0.0) && (fpy<=1.0) ) @@ -66,28 +88,40 @@ static void pdp_binary_setcur(t_pdp_binary *x, t_floatarg fpx, t_floatarg fpy static void pdp_binary_y(t_pdp_binary *x, t_floatarg fy ) { - if ( fy <= 255. ) + if ( fy <= 255. && fy >= 0. ) { x->x_colorY = (int)fy; outlet_float( x->x_Y, x->x_colorY ); + x->x_colorR = yuv_YUVtoR( x->x_colorY, x->x_colorU, x->x_colorV ); + x->x_colorG = yuv_YUVtoG( x->x_colorY, x->x_colorU, x->x_colorV ); + x->x_colorB = yuv_YUVtoB( x->x_colorY, x->x_colorU, x->x_colorV ); + if (glist_isvisible(x->x_canvas)) pdp_binary_draw_color( x ); } } static void pdp_binary_u(t_pdp_binary *x, t_floatarg fu ) { - if ( fu <= 255. ) + if ( fu <= 255. && fu >= 0. ) { x->x_colorU = (int)fu; outlet_float( x->x_U, x->x_colorU ); + x->x_colorR = yuv_YUVtoR( x->x_colorY, x->x_colorU, x->x_colorV ); + x->x_colorG = yuv_YUVtoG( x->x_colorY, x->x_colorU, x->x_colorV ); + x->x_colorB = yuv_YUVtoB( x->x_colorY, x->x_colorU, x->x_colorV ); + if (glist_isvisible(x->x_canvas)) pdp_binary_draw_color( x ); } } static void pdp_binary_v(t_pdp_binary *x, t_floatarg fv ) { - if ( fv < 255 ) + if ( fv < 255 && fv >= 0. ) { x->x_colorV = (int)fv; outlet_float( x->x_V, x->x_colorV ); + x->x_colorR = yuv_YUVtoR( x->x_colorY, x->x_colorU, x->x_colorV ); + x->x_colorG = yuv_YUVtoG( x->x_colorY, x->x_colorU, x->x_colorV ); + x->x_colorB = yuv_YUVtoB( x->x_colorY, x->x_colorU, x->x_colorV ); + if (glist_isvisible(x->x_canvas)) pdp_binary_draw_color( x ); } } @@ -130,6 +164,10 @@ static void pdp_binary_pick(t_pdp_binary *x) outlet_float( x->x_Y, x->x_colorY ); outlet_float( x->x_V, x->x_colorV ); outlet_float( x->x_U, x->x_colorU ); + x->x_colorR = yuv_YUVtoR( x->x_colorY, x->x_colorU, x->x_colorV ); + x->x_colorG = yuv_YUVtoG( x->x_colorY, x->x_colorU, x->x_colorV ); + x->x_colorB = yuv_YUVtoB( x->x_colorY, x->x_colorU, x->x_colorV ); + if (glist_isvisible(x->x_canvas)) pdp_binary_draw_color( x ); } } @@ -171,16 +209,20 @@ static void pdp_binary_process_yv12(t_pdp_binary *x) x->x_vsize = x->x_vwidth*x->x_vheight; pdp_binary_allocate( x ); post( "pdp_binary : reallocated buffers" ); + outlet_float( x->x_Y, x->x_colorY ); + outlet_float( x->x_V, x->x_colorV ); + outlet_float( x->x_U, x->x_colorU ); } memcpy(x->x_frame, data, (x->x_vsize + (x->x_vsize>>1))<<1 ); - - // post( "pdp_binary : newheader:%x", newheader ); + memset(newdata, 0x0, (x->x_vsize + (x->x_vsize>>1))<<1 ); newheader->info.image.encoding = header->info.image.encoding; newheader->info.image.width = x->x_vwidth; newheader->info.image.height = x->x_vheight; + // post( "pdp_binary : y=%d, u=%d, v=%d", x->x_colorY, x->x_colorU, x->x_colorV ); + // binarize pfY = data; pfV = data+x->x_vsize; @@ -193,8 +235,6 @@ static void pdp_binary_process_yv12(t_pdp_binary *x) v = ((*pfV)>>8)+128; u = ((*pfU)>>8)+128; - // post( "pdp_binary : y=%d, u=%d, v=%d", y, u, v ); - diff = 0; if ( x->x_colorY >= 0 ) { @@ -213,10 +253,6 @@ static void pdp_binary_process_yv12(t_pdp_binary *x) { *(newdata+(py*x->x_vwidth+px)) = 0xff<<7; } - else - { - *(newdata+(py*x->x_vwidth+px)) = 0; - } pfY++; if ( (px%2==0) && (py%2==0) ) @@ -226,8 +262,6 @@ static void pdp_binary_process_yv12(t_pdp_binary *x) } } - memset( newdata+x->x_vsize, 0x0, (x->x_vsize>>1)<<1 ); - return; } @@ -319,6 +353,10 @@ void *pdp_binary_new(void) x->x_colorU = -1; x->x_colorV = -1; + x->x_colorR = yuv_YUVtoR( x->x_colorY, x->x_colorU, x->x_colorV ); + x->x_colorG = yuv_YUVtoG( x->x_colorY, x->x_colorU, x->x_colorV ); + x->x_colorB = yuv_YUVtoB( x->x_colorY, x->x_colorU, x->x_colorV ); + x->x_packet0 = -1; x->x_packet1 = -1; @@ -331,6 +369,8 @@ void *pdp_binary_new(void) x->x_vsize = -1; x->x_frame = NULL; + x->x_canvas = canvas_getcurrent(); + return (void *)x; } @@ -356,7 +396,6 @@ void pdp_binary_setup(void) class_addmethod(pdp_binary_class, (t_method)pdp_binary_pick, gensym("pick"), A_NULL); class_addmethod(pdp_binary_class, (t_method)pdp_binary_tolerance, gensym("tolerance"), A_FLOAT, A_NULL); class_addmethod(pdp_binary_class, (t_method)pdp_binary_setcur, gensym("setcur"), A_DEFFLOAT, A_DEFFLOAT, A_NULL); - } #ifdef __cplusplus diff --git a/modules/pdp_cmap.c b/modules/pdp_cmap.c index 994dc24..ec377fc 100644 --- a/modules/pdp_cmap.c +++ b/modules/pdp_cmap.c @@ -282,9 +282,9 @@ static void pdp_cmap_pick(t_pdp_cmap *x) x->x_colorG = yuv_YUVtoG( y, u, v ); x->x_colorB = yuv_YUVtoB( y, u, v ); if (glist_isvisible(x->x_canvas)) pdp_cmap_draw_color( x, x->x_colorR, x->x_colorG, x->x_colorB ); - x->x_colors[x->x_current].y = 255; - x->x_colors[x->x_current].u = 255; - x->x_colors[x->x_current].v = 255; + x->x_colors[x->x_current].y = rand() & 255; + x->x_colors[x->x_current].u = rand() & 255; + x->x_colors[x->x_current].v = rand() & 255; x->x_colors[x->x_current].on = 1; } } @@ -362,8 +362,8 @@ static void pdp_cmap_process_yv12(t_pdp_cmap *x) { // change color not luminosity // *pfY = x->x_colors[ci].y; - *pfV = x->x_colors[ci].v; - *pfU = x->x_colors[ci].u; + *pfV = ( x->x_colors[ci].v - 128 )<<8; + *pfU = ( x->x_colors[ci].u - 128 )<<8; } pfY++;poY++; @@ -533,7 +533,6 @@ void pdp_cmap_setup(void) class_addmethod(pdp_cmap_class, (t_method)pdp_cmap_delete, gensym("delete"), A_DEFFLOAT, A_NULL); class_addmethod(pdp_cmap_class, (t_method)pdp_cmap_resize, gensym("resize"), A_DEFFLOAT, A_NULL); class_addmethod(pdp_cmap_class, (t_method)pdp_cmap_setcur, gensym("setcur"), A_DEFFLOAT, A_DEFFLOAT, A_NULL); - } #ifdef __cplusplus -- cgit v1.2.1