diff options
Diffstat (limited to 'pix_opencv_warpperspective-help.pd')
-rw-r--r-- | pix_opencv_warpperspective-help.pd | 214 |
1 files changed, 47 insertions, 167 deletions
diff --git a/pix_opencv_warpperspective-help.pd b/pix_opencv_warpperspective-help.pd index 33f2452..339cbb9 100644 --- a/pix_opencv_warpperspective-help.pd +++ b/pix_opencv_warpperspective-help.pd @@ -1,148 +1,24 @@ -#N canvas 295 24 980 660 10; +#N canvas 624 372 980 660 10; #X obj 24 25 gemhead; #X obj 411 543 gemwin; #X msg 411 509 create \, 1; #X msg 492 509 destroy; #X obj 24 565 pix_texture; -#X obj 24 93 pix_film; -#X obj 187 328 pix_texture; -#X obj 187 308 pix_opencv_findchessboardcorners; -#X obj 187 254 pack 6 7; -#X floatatom 187 234 5 0 0 0 - - -; -#X floatatom 240 234 5 0 0 0 - - -; -#X msg 187 274 patternSize \$1 \$2; -#N canvas 502 24 715 644 generates_coords 0; -#X obj 49 31 inlet; -#X obj 77 251 until; -#X obj 77 358 f; -#X msg 95 335 0; -#X obj 90 118 unpack; -#X obj 81 462 pack; -#X obj 77 188 f; -#X obj 177 251 until; -#X obj 209 358 f; -#X msg 227 335 0; -#X obj 177 287 t b b; -#X obj 177 188 f; -#X obj 90 143 t b f; -#X obj 81 501 list; -#X obj 57 521 list; -#X obj 81 482 list prepend; -#X obj 58 591 outlet; -#X text 185 97 generates source coordinates to find homography; -#X obj 89 437 + 0; -#X obj 221 437 + 0; -#X floatatom 420 348 5 0 0 0 offset_y - -; -#X obj 57 89 t b l b; -#X obj 77 208 t f b; -#X obj 177 208 t f b; -#X floatatom 420 328 5 0 0 0 offset_x - -; -#X floatatom 420 308 5 0 0 0 taille_du_cote_en_m - -; -#X obj 105 358 + 0.25; -#X obj 237 358 + 0.25; -#X msg 90 62 6 7; -#X obj 57 545 list prepend dstMatrix; -#X obj 57 566 route list; -#X obj 267 269 t b a; -#X obj 411 185 loadbang; -#X obj 352 399 t b a; -#X obj 277 389 t b a; -#X msg 409 216 11; -#X msg 450 216 493; -#X msg 492 216 137; -#X connect 0 0 21 0; -#X connect 1 0 2 0; -#X connect 2 0 18 0; -#X connect 2 0 26 0; -#X connect 3 0 2 1; -#X connect 4 0 12 0; -#X connect 4 1 11 1; -#X connect 5 0 15 0; -#X connect 6 0 22 0; -#X connect 7 0 10 0; -#X connect 8 0 19 0; -#X connect 8 0 27 0; -#X connect 9 0 8 1; -#X connect 10 0 6 0; -#X connect 10 1 8 0; -#X connect 11 0 23 0; -#X connect 12 0 11 0; -#X connect 12 1 6 1; -#X connect 13 0 14 1; -#X connect 13 0 15 1; -#X connect 14 0 29 0; -#X connect 15 0 13 0; -#X connect 18 0 5 0; -#X connect 19 0 5 1; -#X connect 20 0 33 0; -#X connect 21 0 14 0; -#X connect 21 1 4 0; -#X connect 21 2 15 1; -#X connect 22 0 1 0; -#X connect 22 1 3 0; -#X connect 23 0 7 0; -#X connect 23 1 9 0; -#X connect 24 0 34 0; -#X connect 25 0 31 0; -#X connect 26 0 2 1; -#X connect 27 0 8 1; -#X connect 28 0 21 0; -#X connect 29 0 30 0; -#X connect 30 0 16 0; -#X connect 31 0 28 0; -#X connect 31 1 27 1; -#X connect 31 1 26 1; -#X connect 32 0 35 0; -#X connect 32 0 36 0; -#X connect 32 0 37 0; -#X connect 33 0 28 0; -#X connect 33 1 19 1; -#X connect 34 0 28 0; -#X connect 34 1 18 1; -#X connect 35 0 25 0; -#X connect 36 0 24 0; -#X connect 37 0 20 0; -#X restore 426 309 pd generates_coords; -#X obj 408 350 list prepend srcMatrix; -#X obj 187 348 translateXYZ 2 2 0; -#X obj 187 368 rectangle 2 1.5; -#X obj 408 377 route list; #X obj 203 571 print; -#X obj 24 512 separator; -#X obj 50 49 loadbang; -#X obj 104 262 spigot; -#X obj 139 139 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 -1; -#X msg 50 69 open shoot-2.mov \, auto 1; -#X obj 24 301 spigot 1; -#X obj 112 240 == 0; -#X obj 24 113 pix_grey; #X obj 24 591 rectangle 4 3; #X obj 23 -3 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1 ; -#X text 485 9 pix_opencv_wapperspective finds the transformation matrix -between srcMatrix and dstMatrix; -#X text 485 38 it sends through its second outlet the 3x3 transformation -matrix when a correct scrMatrix message is received; -#X text 484 65 you should first initiliaze dstMatrix; #X obj 24 539 pix_opencv_warpperspective; -#X text 482 86 it also applied the tansformation matrix on incomming -image stream; -#X text 482 151 pix_opencv_findchessboardcorners finds chessboard corners -in the incomming image stream and send out corners coordinates as a -list trought its second outlet; -#X text 484 200 it also prints found corners on the image stream; -#X msg 409 423 mapMatrix 1 0 0 0 1 0 0 0 1; -#X text 408 404 you can also set the map matrix directly; -#X msg 409 443 mapMatrix 0.5 0 0 0 0.5 0 0 0 1; -#X text 614 422 identity; -#X text 635 444 scale by 0.5; -#X msg 409 463 mapMatrix 0 1 0 1 0 0 0 0 2; -#X text 608 465 rotation by 90deg and scale by 0.5; -#X text 156 134 switch to find corners and mapMatrix and switch back -to apply it; -#X text 186 211 number of inner corners in each direction; -#N canvas 0 0 936 545 wrap_perspective_GPU 0; +#X msg 96 437 mapMatrix 1 0 0 0 1 0 0 0 1; +#X text 95 418 you can also set the map matrix directly; +#X msg 96 457 mapMatrix 0.5 0 0 0 0.5 0 0 0 1; +#X text 301 436 identity; +#X text 322 458 scale by 0.5; +#X msg 96 477 mapMatrix 0 1 0 1 0 0 0 0 2; +#X text 295 479 rotation by 90deg and scale by 0.5; +#X obj 24 93 pix_video; +#X obj 24 133 pix_flip; +#N canvas 3 81 936 545 wrap_perspective_GPU 0; #X obj 251 443 mesh_square 10 10; #X obj 301 277 /; #X obj 351 278 /; @@ -172,6 +48,7 @@ order to boost performace; from 0 to 639 in X \, and from 0 to 479 in Y \, one have to convert (scale / translate) the primitive coordinate to fit the transformation matrix.; +#X obj 41 62 inlet; #X connect 1 0 6 1; #X connect 2 0 6 2; #X connect 3 0 10 0; @@ -195,38 +72,41 @@ matrix.; #X connect 20 0 19 0; #X connect 21 0 20 0; #X connect 21 1 12 0; -#X restore 413 589 pd wrap_perspective_GPU; -#X connect 0 0 5 0; +#X connect 24 0 16 0; +#X restore 161 604 pd wrap_perspective_GPU; +#X obj 24 113 pix_grey; +#X msg 43 233 dstMatrix 0 0 0 1 1 1 1 0; +#X msg 59 281 srcMatrix 0 0 0 1 1 1 1 0; +#X text 203 234 destination matrix; +#X text 103 261 source matrix; +#X text 229 279 the same as dst lead to identity map matrix; +#X msg 71 306 srcMatrix 1 0 1 1 2 1 2 0; +#X text 234 299 translation also lead to identity map matrix while +translation is not a perspective transformation; +#X text 126 327 TODO more src examples...; +#X text 112 88 pix_opencv_warpperspective computes the perspective +transformation between dstMatrix and srcMatrix and corrects the image +image according to this perspective transformation; +#X text 111 129 the trasnsformation matrix is also sent through the +right outlet to be applied in OpenGL for example; +#X text 114 159 the transformation matrix could also be set by mapMatrix +message to apply the transformation; +#X text 112 25 see examples/05-perspective_correction for an example +of the use of pix_opencv_warpperspective with pix_opencv_findchessboardcorners +to correct perspective; +#X connect 0 0 16 0; #X connect 2 0 1 0; #X connect 3 0 1 0; -#X connect 4 0 26 0; -#X connect 5 0 25 0; -#X connect 5 2 22 0; -#X connect 6 0 14 0; -#X connect 7 0 6 0; -#X connect 7 1 13 0; -#X connect 8 0 11 0; -#X connect 8 0 12 0; +#X connect 4 0 6 0; +#X connect 7 0 0 0; +#X connect 8 0 4 0; +#X connect 8 1 5 0; #X connect 9 0 8 0; -#X connect 10 0 8 1; -#X connect 11 0 7 0; -#X connect 12 0 31 0; -#X connect 13 0 16 0; -#X connect 14 0 15 0; -#X connect 16 0 31 0; -#X connect 18 0 31 0; -#X connect 19 0 22 0; -#X connect 20 0 7 0; -#X connect 21 0 20 1; -#X connect 21 0 24 0; -#X connect 22 0 5 0; -#X connect 23 0 18 0; -#X connect 24 0 23 1; -#X connect 25 0 23 0; -#X connect 25 0 20 0; -#X connect 27 0 0 0; -#X connect 31 0 4 0; -#X connect 31 1 17 0; -#X connect 35 0 31 0; -#X connect 37 0 31 0; -#X connect 40 0 31 0; +#X connect 11 0 8 0; +#X connect 14 0 8 0; +#X connect 16 0 19 0; +#X connect 17 0 8 0; +#X connect 19 0 17 0; +#X connect 20 0 8 0; +#X connect 21 0 8 0; +#X connect 25 0 8 0; |