aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Villeret <avilleret@users.sourceforge.net>2013-05-18 11:04:33 +0000
committerAntoine Villeret <avilleret@users.sourceforge.net>2013-05-18 11:04:33 +0000
commite789fb1bf7088aa4a4d06c8113978069cd586adf (patch)
tree84c753577204f26cd57ab4e203f3284097055e80
parent467d0a6639e231ced68a18a5c6e4bf32b5562635 (diff)
add vp calibration example
svn path=/trunk/externals/pix_opencv/; revision=17140
-rw-r--r--examples/09_vp_calibration/09_vp_calibration.pd261
-rw-r--r--examples/09_vp_calibration/pattern.pngbin0 -> 22255 bytes
-rw-r--r--examples/09_vp_calibration/subprocess.pd73
-rw-r--r--examples/09_vp_calibration/test.pd107
4 files changed, 441 insertions, 0 deletions
diff --git a/examples/09_vp_calibration/09_vp_calibration.pd b/examples/09_vp_calibration/09_vp_calibration.pd
new file mode 100644
index 0000000..2277360
--- /dev/null
+++ b/examples/09_vp_calibration/09_vp_calibration.pd
@@ -0,0 +1,261 @@
+#N canvas 904 187 901 736 10;
+#X declare -path ../../;
+#X obj 17 13 declare -path ../../;
+#X text -18 0 declare path to be sure externals were found...;
+#X obj 234 247 gemhead;
+#X obj 9 588 gemwin;
+#X obj 234 268 pix_image pattern.png;
+#X obj 234 290 pix_texture;
+#X msg 23 555 destroy;
+#N canvas 1042 262 739 611 compute_perspective 0;
+#N canvas 1 98 450 300 format 0;
+#X obj 93 7 inlet;
+#X obj 118 140 outlet;
+#X msg 108 68 \$1 \$4 0 \$7 \$2 \$5 0 \$8 0 0 1 0 \$3 \$6 0 \$9;
+#X connect 0 0 2 0;
+#X connect 2 0 1 0;
+#X restore 17 474 pd format;
+#N canvas 1 86 643 318 mapMatrix 0;
+#X obj 110 263 pack 0 0 0 0 0 0 0 0 0;
+#X floatatom 110 121 5 0 0 0 - - -;
+#X floatatom 160 121 5 0 0 0 - - -;
+#X floatatom 210 121 5 0 0 0 - - -;
+#X floatatom 110 141 5 0 0 0 - - -;
+#X floatatom 160 141 5 0 0 0 - - -;
+#X floatatom 210 141 5 0 0 0 - - -;
+#X floatatom 110 161 5 0 0 0 - - -;
+#X floatatom 160 161 5 0 0 0 - - -;
+#X floatatom 210 161 5 0 0 0 - - -;
+#X obj 110 285 outlet;
+#X obj 110 29 inlet;
+#X obj 110 59 unpack 0 0 0 0 0 0 0 0 0;
+#X obj 146 195 t b f;
+#X obj 189 196 t b f;
+#X obj 231 196 t b f;
+#X obj 273 195 t b f;
+#X obj 316 195 t b f;
+#X obj 362 195 t b f;
+#X obj 406 195 t b f;
+#X obj 456 195 t b f;
+#X connect 0 0 10 0;
+#X connect 1 0 0 0;
+#X connect 2 0 13 0;
+#X connect 3 0 14 0;
+#X connect 4 0 15 0;
+#X connect 5 0 16 0;
+#X connect 6 0 17 0;
+#X connect 7 0 18 0;
+#X connect 8 0 19 0;
+#X connect 9 0 20 0;
+#X connect 11 0 12 0;
+#X connect 12 0 1 0;
+#X connect 12 1 2 0;
+#X connect 12 2 3 0;
+#X connect 12 3 4 0;
+#X connect 12 4 5 0;
+#X connect 12 5 6 0;
+#X connect 12 6 7 0;
+#X connect 12 7 8 0;
+#X connect 12 8 9 0;
+#X connect 13 0 0 0;
+#X connect 13 1 0 1;
+#X connect 14 0 0 0;
+#X connect 14 1 0 2;
+#X connect 15 0 0 0;
+#X connect 15 1 0 3;
+#X connect 16 0 0 0;
+#X connect 16 1 0 4;
+#X connect 17 0 0 0;
+#X connect 17 1 0 5;
+#X connect 18 0 0 0;
+#X connect 18 1 0 6;
+#X connect 19 0 0 0;
+#X connect 19 1 0 7;
+#X connect 20 0 0 0;
+#X connect 20 1 0 8;
+#X coords 0 -1 1 1 150 80 1 100 100;
+#X restore 17 391 pd mapMatrix;
+#X obj -136 371 pix_opencv_warpperspective;
+#X text 76 473 <-- transform into a 4x4;
+#X text 101 483 openGL transpose matrix;
+#X obj -137 194 loadbang;
+#X obj 101 101 cnv 15 240 60 empty empty VP_calib 20 12 0 14 -262130
+-66577 0;
+#X floatatom 253 124 5 0 0 0 - - -;
+#X floatatom 293 124 5 0 0 0 - - -;
+#X floatatom 253 144 5 0 0 0 - - -;
+#X floatatom 293 144 5 0 0 0 - - -;
+#X floatatom 111 124 5 0 0 0 - - -;
+#X floatatom 151 124 5 0 0 0 - - -;
+#X floatatom 111 144 5 0 0 0 - - -;
+#X floatatom 151 144 5 0 0 0 - - -;
+#X text 206 124 VP 1;
+#X obj 139 -12 unpack 0 0 0 0 0 0 0 0;
+#X obj 139 -52 loadbang;
+#X obj 74 258 pack 0 0 0 0 0 0 0 0;
+#X obj 74 217 t b f;
+#X obj 110 217 t b f;
+#X obj 146 217 t b f;
+#X obj 182 217 t b f;
+#X obj 218 217 t b f;
+#X obj 254 217 t b f;
+#X obj 290 217 t b f;
+#X msg 74 280 dstMatrix \$1 \$2 \$3 \$4 \$5 \$6 \$7 \$8;
+#X obj 17 496 outlet;
+#X obj -136 497 outlet;
+#X obj -123 -47 inlet;
+#X msg 474 -23 -1 1 1 1 -1 -1 1 -1;
+#X msg 304 5 -4 3 4 3 -4 -3 4 -3;
+#X msg -122 256 srcMatrix -4 3 4 3 -4 -3 4 -3;
+#X msg -130 235 srcMatrix -1 1 1 1 -1 -1 1 -1;
+#X msg -136 214 srcMatrix -1 1 1 1 -1 -1 1 -1;
+#X obj -125 338 pix_buf;
+#X obj 74 302 t b a;
+#X obj 201 107 bng 15 250 50 0 empty empty reset 17 7 0 10 -262144
+-1 -1;
+#X obj -123 -25 pix_info ______________;
+#X msg 434 40 srcMatrix -1 1 1 1 -1 -1 1 -1;
+#X obj -11 7 * -1;
+#X obj 39 7 * -1;
+#X obj -123 -2 t a b;
+#X obj -96 37 spigot;
+#X obj -118 123 spigot;
+#X obj 43 -47 inlet;
+#X obj 43 -23 == 0;
+#X obj 90 -10 print;
+#X obj -47 194 print;
+#X obj -96 62 pack -1 0 0 0 0 0 0 0 0;
+#X obj -96 82 route -1;
+#X msg -96 153 srcMatrix \$1 \$2 \$3 \$4 \$5 \$6 \$7 \$8;
+#X msg -67 118 set \$1 \$2 \$3 \$4 \$5 \$6 \$7 \$8;
+#X msg 124 330 invert \$1;
+#X obj 124 310 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X msg 244 -52 -1830 1330 1830 1330 -1830 -1330 1830 -1330;
+#X msg 139 -32 -1 1 1 1 -1 -1 1 -1;
+#X connect 0 0 27 0;
+#X connect 1 0 0 0;
+#X connect 2 0 28 0;
+#X connect 2 1 1 0;
+#X connect 5 0 34 0;
+#X connect 7 0 20 0;
+#X connect 8 0 21 0;
+#X connect 9 0 24 0;
+#X connect 10 0 25 0;
+#X connect 11 0 18 0;
+#X connect 12 0 19 0;
+#X connect 13 0 22 0;
+#X connect 14 0 23 0;
+#X connect 16 0 11 0;
+#X connect 16 1 12 0;
+#X connect 16 2 7 0;
+#X connect 16 3 8 0;
+#X connect 16 4 13 0;
+#X connect 16 5 14 0;
+#X connect 16 6 9 0;
+#X connect 16 7 10 0;
+#X connect 17 0 56 0;
+#X connect 18 0 26 0;
+#X connect 19 0 18 0;
+#X connect 19 1 18 1;
+#X connect 20 0 18 0;
+#X connect 20 1 18 2;
+#X connect 21 0 18 0;
+#X connect 21 1 18 3;
+#X connect 22 0 18 0;
+#X connect 22 1 18 4;
+#X connect 23 0 18 0;
+#X connect 23 1 18 5;
+#X connect 24 0 18 0;
+#X connect 24 1 18 6;
+#X connect 25 0 18 0;
+#X connect 25 1 18 7;
+#X connect 26 0 36 0;
+#X connect 29 0 38 0;
+#X connect 34 0 2 0;
+#X connect 35 0 2 0;
+#X connect 36 0 35 0;
+#X connect 36 1 2 0;
+#X connect 37 0 56 0;
+#X connect 38 0 42 0;
+#X connect 38 1 40 0;
+#X connect 38 1 49 3;
+#X connect 38 1 49 7;
+#X connect 38 2 41 0;
+#X connect 38 2 49 2;
+#X connect 38 2 49 4;
+#X connect 40 0 49 1;
+#X connect 40 0 49 5;
+#X connect 41 0 49 6;
+#X connect 41 0 49 8;
+#X connect 42 0 35 0;
+#X connect 42 1 43 0;
+#X connect 42 1 44 0;
+#X connect 43 0 49 0;
+#X connect 44 0 34 0;
+#X connect 45 0 46 0;
+#X connect 45 0 44 1;
+#X connect 46 0 43 1;
+#X connect 46 0 47 0;
+#X connect 49 0 50 0;
+#X connect 50 0 51 0;
+#X connect 50 0 52 0;
+#X connect 51 0 2 0;
+#X connect 52 0 56 0;
+#X connect 53 0 2 0;
+#X connect 54 0 53 0;
+#X connect 56 0 16 0;
+#X coords 0 -1 1 1 242 62 2 100 100;
+#X restore 144 155 pd compute_perspective;
+#X obj 234 379 scaleXYZ 1 1 0;
+#X msg 9 527 color 0 0 1 1 \, dimen 640 480 \, create \, 1;
+#X obj 501 332 gemhead;
+#X obj 501 353 pix_image pattern.png;
+#X obj 501 405 pix_texture;
+#X obj 501 427 pix_opencv_warpperspective;
+#X obj 144 295 pix_texture;
+#X obj 144 87 gemhead;
+#X obj 144 66 == 0;
+#X obj 234 24 vradio 15 1 0 2 empty empty empty 0 -8 0 10 -262144 -1
+-1 1;
+#X obj 144 108 pix_image pattern.png;
+#X obj 144 130 pix_rgba;
+#X obj 234 -36 loadbang;
+#X msg 234 -14 1;
+#X text 249 24 CPU;
+#X text 249 38 GPU;
+#X obj 234 312 scaleXYZ 4 3 1;
+#X obj 234 405 square 1 1;
+#X obj 144 359 rectangle 1 1;
+#X obj 144 324 scaleXYZ 4 3 1;
+#X floatatom 339 301 5 0 0 0 - - -;
+#X obj 323 444 GEMglMultTransposeMatrixf;
+#X obj 234 353 GEMglMultTransposeMatrixf;
+#X text 375 62 This demonstrates how to use pix_opencv_warpperspective
+to compute perspective transformation and to apply it with OpenGL;
+#X text 403 130 Very useful to quickly setup video projector;
+#X connect 2 0 4 0;
+#X connect 4 0 5 0;
+#X connect 5 0 24 0;
+#X connect 6 0 3 0;
+#X connect 7 0 14 0;
+#X connect 7 1 30 1;
+#X connect 8 0 25 0;
+#X connect 9 0 3 0;
+#X connect 10 0 11 0;
+#X connect 11 0 12 0;
+#X connect 12 0 13 0;
+#X connect 14 0 27 0;
+#X connect 15 0 18 0;
+#X connect 16 0 15 0;
+#X connect 17 0 2 0;
+#X connect 17 0 16 0;
+#X connect 17 0 7 1;
+#X connect 18 0 19 0;
+#X connect 19 0 7 0;
+#X connect 20 0 21 0;
+#X connect 21 0 17 0;
+#X connect 24 0 30 0;
+#X connect 27 0 26 0;
+#X connect 28 0 24 1;
+#X connect 30 0 8 0;
diff --git a/examples/09_vp_calibration/pattern.png b/examples/09_vp_calibration/pattern.png
new file mode 100644
index 0000000..5227c91
--- /dev/null
+++ b/examples/09_vp_calibration/pattern.png
Binary files differ
diff --git a/examples/09_vp_calibration/subprocess.pd b/examples/09_vp_calibration/subprocess.pd
new file mode 100644
index 0000000..55b53ac
--- /dev/null
+++ b/examples/09_vp_calibration/subprocess.pd
@@ -0,0 +1,73 @@
+#N canvas 745 670 837 384 10;
+#X obj 313 153 gemhead;
+#X obj 313 198 pix_image;
+#X msg 374 162 open pattern.png;
+#X obj 313 218 pix_texture;
+#X obj 374 142 loadbang;
+#X obj 313 288 translateXYZ;
+#X obj 313 308 rotateXYZ;
+#X obj -60 342 gemwin;
+#X obj 313 328 scaleXYZ;
+#X obj -61 72 t b a;
+#X obj -61 122 pix_grey;
+#X obj -61 53 gemhead 100;
+#X obj 313 238 pix_info ________;
+#X obj 313 348 rectangle 1 1;
+#X obj -61 142 pix_share_write 666 640 480 1;
+#X obj -60 222 loadbang;
+#X msg -33 264 \; pd dsp 1;
+#X obj -60 241 t b b;
+#X text 27 268 <- dsp must always be ON;
+#X text 44 278 inside a pd~;
+#X obj 327 264 /;
+#X text 351 264 <-- keep image ratio;
+#X obj -61 102 pix_snap 0 0 640 480;
+#X msg -18 342 destroy;
+#X msg -60 311 reset \, color 1 1 1 \, title subprocess \, dimen 640
+480 \, create \, 1;
+#X text -60 32 readback and send to host;
+#X text 334 54 the chessboard should be big enougth and not too warp
+in order to detect corners;
+#X text 334 16 move the chessboard in the subprocess wiev it shouldn't
+move in the 05_perspective_correction window;
+#X obj 577 105 nbx 5 14 -1e+37 1e+37 0 1 empty empty posX 0 -8 0 10
+-262144 -1 -1 0.01 256;
+#X obj 637 105 nbx 5 14 -1e+37 1e+37 0 1 empty empty posY 0 -8 0 10
+-262144 -1 -1 -0.77 256;
+#X obj 609 177 nbx 5 14 -1e+37 1e+37 0 1 empty empty scale 0 -8 0 10
+-262144 -1 -1 2.22 256;
+#X obj 547 142 nbx 5 14 -1e+37 1e+37 0 1 empty empty rotX 0 -8 0 10
+-262144 -1 -1 26.62 256;
+#X obj 607 142 nbx 5 14 -1e+37 1e+37 0 1 empty empty rotY 0 -8 0 10
+-262144 -1 -1 12.15 256;
+#X obj 667 141 nbx 5 14 -1e+37 1e+37 0 1 empty empty rotZ 0 -8 0 10
+-262144 -1 -1 -157.27 256;
+#X connect 0 0 1 0;
+#X connect 1 0 3 0;
+#X connect 2 0 1 0;
+#X connect 3 0 12 0;
+#X connect 4 0 2 0;
+#X connect 5 0 6 0;
+#X connect 6 0 8 0;
+#X connect 8 0 13 0;
+#X connect 9 0 22 0;
+#X connect 9 1 22 0;
+#X connect 10 0 14 0;
+#X connect 11 0 9 0;
+#X connect 12 0 5 0;
+#X connect 12 1 20 0;
+#X connect 12 2 20 1;
+#X connect 15 0 17 0;
+#X connect 17 0 24 0;
+#X connect 17 1 16 0;
+#X connect 20 0 13 1;
+#X connect 22 0 10 0;
+#X connect 23 0 7 0;
+#X connect 24 0 7 0;
+#X connect 28 0 5 1;
+#X connect 29 0 5 2;
+#X connect 30 0 8 2;
+#X connect 30 0 8 1;
+#X connect 31 0 6 1;
+#X connect 32 0 6 2;
+#X connect 33 0 6 3;
diff --git a/examples/09_vp_calibration/test.pd b/examples/09_vp_calibration/test.pd
new file mode 100644
index 0000000..40fa21b
--- /dev/null
+++ b/examples/09_vp_calibration/test.pd
@@ -0,0 +1,107 @@
+#N canvas 647 219 963 860 10;
+#X msg 132 17 -1 1 1 1 -1 -1 1 -1;
+#X obj 128 88 gemhead;
+#X obj 128 179 GEMglHint GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST;
+#X obj 128 669 GEMglEnd;
+#X obj 264 242 GLdefine GL_SMOOTH;
+#X obj 264 220 loadbang;
+#X obj 264 262 loadbang;
+#X obj 264 284 GLdefine GL_POLYGON;
+#X obj 128 302 GEMglBegin;
+#X obj 128 260 GEMglShadeModel;
+#X obj 281 652 loadbang;
+#X obj 128 692 GEMglShadeModel;
+#X obj 281 674 GLdefine GL_FLAT;
+#X msg 273 578 1 0 1;
+#X msg 315 578 1 1 0;
+#X floatatom 309 415 3 0 100 0 - - -;
+#X obj 309 436 * 0.01;
+#X msg 331 218 bang;
+#X floatatom 212 316 5 0 0 0 - - -;
+#X floatatom 298 321 5 0 0 0 - - -;
+#N canvas 85 188 247 179 Gem.init 0;
+#X obj 118 46 loadbang;
+#X msg 118 81 reset;
+#X obj 118 113 outlet;
+#X connect 0 0 1 0;
+#X connect 1 0 2 0;
+#X restore 557 112 pd Gem.init;
+#N canvas 340 107 682 322 gemwin 0;
+#X obj 102 122 tgl 15 0 \$0-gemstart \$0-gemstart empty 17 7 0 10 -262144
+-1 -1 1 1;
+#X obj 102 161 r \$0-gemstart;
+#X obj 102 182 select 1 0;
+#X msg 102 214 create \, 1;
+#X msg 177 215 destroy;
+#X obj 102 239 t a;
+#X obj 318 54 inlet;
+#X obj 318 255 gemwin;
+#X obj 318 100 t a a;
+#X obj 318 287 outlet;
+#X obj 350 128 route create destroy;
+#X obj 350 150 t b;
+#X msg 350 172 1;
+#X obj 390 150 t b;
+#X msg 390 172 0;
+#X obj 350 195 t f;
+#X msg 350 219 set \$1;
+#X text 118 122 rendering;
+#X connect 1 0 2 0;
+#X connect 2 0 3 0;
+#X connect 2 1 4 0;
+#X connect 3 0 5 0;
+#X connect 4 0 5 0;
+#X connect 5 0 8 0;
+#X connect 6 0 8 0;
+#X connect 7 0 9 0;
+#X connect 8 0 7 0;
+#X connect 8 1 10 0;
+#X connect 10 0 11 0;
+#X connect 10 1 13 0;
+#X connect 11 0 12 0;
+#X connect 12 0 15 0;
+#X connect 13 0 14 0;
+#X connect 14 0 15 0;
+#X connect 15 0 16 0;
+#X connect 16 0 0 0;
+#X coords 0 -1 1 1 85 40 1 100 100;
+#X restore 557 143 pd gemwin;
+#X obj 128 111 pix_image patten.png;
+#X obj 128 133 pix_texture;
+#X obj 128 388 GEMglTexCoord2f 0 0;
+#X obj 128 409 GEMglVertex3f -1 -1 0;
+#X obj 128 485 GEMglVertex3f -1 1 0;
+#X obj 128 464 GEMglTexCoord2f 0 1;
+#X obj 128 552 GEMglVertex3f 1 1 0;
+#X obj 128 531 GEMglTexCoord2f 1 1;
+#X obj 128 601 GEMglTexCoord2f 1 0;
+#X obj 128 624 GEMglVertex3fv 1 -1 0;
+#X connect 1 0 22 0;
+#X connect 2 0 9 0;
+#X connect 3 0 11 0;
+#X connect 4 0 9 1;
+#X connect 5 0 4 0;
+#X connect 6 0 7 0;
+#X connect 7 0 8 1;
+#X connect 8 0 24 0;
+#X connect 9 0 8 0;
+#X connect 10 0 12 0;
+#X connect 12 0 11 1;
+#X connect 13 0 30 1;
+#X connect 14 0 30 1;
+#X connect 15 0 16 0;
+#X connect 16 0 27 2;
+#X connect 17 0 4 0;
+#X connect 18 0 25 1;
+#X connect 19 0 25 2;
+#X connect 20 0 21 0;
+#X connect 22 0 23 0;
+#X connect 23 0 2 0;
+#X connect 24 0 25 0;
+#X connect 25 0 27 0;
+#X connect 26 0 29 0;
+#X connect 27 0 26 0;
+#X connect 28 0 30 0;
+#X connect 29 0 28 0;
+#X connect 30 0 31 0;
+#X connect 31 0 3 0;