Forums > Jitter

help with translation to jitter of texture warping function

March 26, 2007 | 5:44 pm

attached is my current method for keystone correction

part of my ongoing battle with perspective skewing i came across this
http://www.nnseek.com/e/comp.graphics.api.opengl/image_warping_texture_mapping_4012964t.html
looking for a way to implement this in jitter.
i currently map a texture to a nurb and play with the ctrlmatrix.
i think this method is better, it handles warping as well as ROI (region of
interest).
did anybody go the way of porting ipp functions to jitter?
a different route to this?

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 135 100 53 9109513 r worldcord;
#P newex 181 145 62 9109513 s keyRender;
#B color 12;
#P newex 173 171 44 9109513 s mouse;
#B color 12;
#P newex 119 224 229 9109513 jit.gl.gridshape doom @automatic 0 @poly_mode 1
1;
#P newex 61 178 68 9109513 t b b;
#P newex 86 100 45 9109513 r render1;
#P toggle 40 31 15 0;
#P newex 40 51 45 9109513 qmetro 2;
#P newex 40 75 53 9109513 t b b erase;
#P newex 42 148 135 9109513 jit.window doom @idlemouse 1;
#P newex 40 123 80 9109513 jit.gl.render doom;
#N vpatcher 481 96 986 512;
#P origin 4 0;
#P window setfont "Sans Serif" 9.;
#P newex 330 252 50 9109513 loadbang;
#P newex 46 273 50 9109513 t b b b;
#P newex 66 321 337 9109513 jit.gl.texture doom @automatic 0 @name keysketch
@adapt 0 @dim 1024 768;
#B color 5;
#P newex 46 350 380 9109513 jit.gl.videoplane doom @automatic 0
@depth_enable 1 @blend_enable 0 @scale 1.333 1.;
#B color 5;
#P message 330 275 148 9109513 reset , drawobject secondsketch 0;
#P newex 86 299 307 9109513 jit.gl.sketch doom @blend_enable 1 @capture
keysketch @automatic 0;
#P newex 46 50 29 9109513 t b b;
#P newex 46 116 65 9109513 t b b b b b;
#P window setfont "Sans Serif" 14.;
#N vpatcher 210 215 1007 601;
#P origin -204 -344;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 468 32 67 9109513 loadmess -0.6;
#P newex 32 -40 38 9109513 sel 113;
#B color 5;
#P newex 32 -61 40 9109513 key;
#B color 5;
#P button 450 192 15 0;
#P newex 466 173 79 9109513 r reset_keystone;
#B color 14;
#P newex 466 241 27 9109513 t b f;
#B color 14;
#P newex 466 197 19 9109513 t b;
#B color 14;
#P newex 466 219 31 9109513 f 0.;
#B color 14;
#P newex 487 197 69 9109513 r cam_position;
#B color 14;
#P newex 52 46 48 9109513 s restvec;
#P newex 54 21 28 9109513 sel 0;
#P newex 29 183 75 9109513 jit.matrix veclen;
#P newex 392 470 60 9109513 pack 0. 0.;
#P newex 442 447 60 9109513 * 1.3;
#P newex 392 426 60 9109513 unpack 0. 0.;
#P newex 121 538 55 9109513 s worldcord;
#P newex 249 481 56 9109513 loadmess 1;
#P window setfont "Sans Serif" 12.;
#P comment 369 78 32 9109516 x;
#P window setfont "Sans Serif" 9.;
#P newex 418 103 67 9109513 s resetKeyst2;
#B color 12;
#P newex 193 -52 65 9109513 r resetKeyst2;
#B color 12;
#P newex 368 323 42 9109513 print;
#P flonum 332 80 35 9 0 0 0 139 0 0 0 255 227 23 222 222 222 0 0 0;
#P newex 199 79 117 9109513 jit.op @op + pass @val 0.;
#P newex 434 322 44 9109513 zl slice 2;
#P newex 168 341 27 9109513 gate;
#P toggle 230 482 15 0;
#P newex 402 374 42 9109513 gate 1 1;
#N vpatcher 143 83 893 469;
#P origin 12 149;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 389 313 35 9109513 t reset;
#P newex 388 290 46 9109513 r restvec;
#P newex 447 231 75 9109513 jit.matrix veclen;
#P message 448 211 61 9109513 getcell $1 $2;
#P newex 483 257 44 9109513 zl slice 4;
#P newex 166 -72 40 9109513 t b l l;
#P newex 447 284 72 9109513 pack 0. 0. 0. 0.;
#P window linecount 0;
#P message 447 308 257 9109513 reset , glbegin lines , glcolor 1 0 0 1 ,
glvertex $1 $2 0.1 , glcolor 0 1 0 1 , glvertex $3 $4 0.1 , glend;
#P window linecount 1;
#P newex 447 352 159 9109513 jit.gl.sketch doom @position 0. 0. 0.;
#P newex 139 288 127 9109513 jit.matrix colorz 4 float32 3 2;
#P newex 139 241 45 9109513 loadbang;
#P message 139 265 105 9109513 setall 0. 0. 1. 0.7 , bang;
#P outlet 19 316 15 0;
#P newex 19 241 40 9109513 t b l b;
#B color 5;
#P newex 19 291 71 9109513 jit.matrix colorz;
#B color 5;
#P message 50 262 74 9109513 setall 0. 0. 1. 1.;
#P newex 166 -100 36 9109513 t l b;
#P newex 34 182 53 9109513 print;
#P button 182 184 15 0;
#P newex 212 134 53 9109513 zl group 4;
#P user multiSlider 212 157 121 103 0. 1. 4 2681 15 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P newex 165 -122 36 9109513 r idlem;
#P newex 19 219 139 9109513 pak setcell 1 1 val 0. 1. 0. 1.;
#B color 5;
#P newex 122 174 48 9109513 gate;
#P newex 122 148 29 9109513 < 0.5;
#P newex 218 -30 45 9109513 zl slice 2;
#P message 218 -76 31 9109513 dump;
#N coll keystone2 1;
#P newobj 218 -52 77 9109513 coll keystone2 1;
#B color 5;
#P newex 264 24 60 9109513 unpack 0. 0.;
#P newex 223 -4 55 9109513 t b l;
#P newex 229 49 27 9109513 f;
#P newex 196 24 60 9109513 unpack 0. 0.;
#P newex 179 49 27 9109513 f;
#P newex 201 111 120 9109513 expr sqrt($f1*$f1+$f2*$f2);
#P newex 266 84 58 9109513 expr $f1-$f2;
#P newex 201 85 58 9109513 expr $f1-$f2;
#P window linecount 2;
#P comment 1 148 115 9109513 on click , find nearest point and changes its
location;
#P connect 14 0 23 0;
#P connect 23 0 22 0;
#P connect 23 1 22 0;
#P connect 21 0 22 0;
#P fasten 27 0 24 0 144 312 24 312;
#P connect 22 0 24 0;
#P fasten 13 0 14 1 127 206 42 206;
#P fasten 23 2 21 0 55 260;
#P fasten 3 0 12 0 206 134 127 134;
#P connect 12 0 13 0;
#P connect 26 0 25 0;
#P connect 25 0 27 0;
#P fasten 11 0 13 1 223 -8 165 -8;
#P connect 15 0 20 0;
#P connect 20 0 31 0;
#P connect 7 0 4 0;
#P connect 17 0 18 0;
#P connect 31 2 5 0;
#P connect 5 0 4 1;
#P connect 4 0 1 0;
#P connect 1 0 3 0;
#P connect 3 0 17 0;
#P connect 17 0 16 0;
#P fasten 20 1 10 0 197 -78 223 -78;
#P fasten 10 0 9 0 223 -56 223 -56;
#P connect 9 0 11 0;
#P fasten 11 1 7 0 258 -8 228 -8;
#P connect 7 0 6 0;
#P connect 5 1 6 1;
#P fasten 8 0 1 1 269 73 254 73;
#P connect 7 1 8 0;
#P connect 6 0 2 0;
#P fasten 2 0 3 1 271 108 316 108;
#P connect 8 1 2 1;
#P connect 35 0 36 0;
#P connect 33 0 34 0;
#P fasten 31 1 30 0 186 262 452 262;
#P connect 30 0 29 0;
#P connect 29 0 28 0;
#P connect 36 0 28 0;
#P fasten 13 0 33 0 127 200 453 200;
#P fasten 34 1 32 0 517 253 488 253;
#P fasten 32 1 30 2 522 279 492 279;
#P pop;
#P newobj 358 182 57 9109513 p keycolor2;
#P newex 401 397 60 9109513 s idlem;
#P newex 435 275 60 9109513 r keyRender;
#B color 12;
#P newex 186 319 44 9109513 r mouse;
#B color 12;
#P newex 413 32 32 9109513 / 1.33;
#P newex 91 -37 57 9109513 r gaterKey2;
#P toggle 86 -13 24 0;
#P newex 114 23 27 9109513 gate;
#P flonum 369 57 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 199 32 124 9109513 jit.op @op pass * @val -0.6;
#P flonum 332 57 35 9 0 0. 2 139 0 0 0 255 227 23 222 222 222 0 0 0;
#P newex 199 56 124 9109513 jit.op @op * pass @val -0.7;
#N comlet bang;
#P inlet 131 4 15 0;
#P comment 116 304 126 9109513 set window to @idlemouse 1;
#P comment 116 321 67 9109513 from window;
#N comlet to gl.nurb;
#P outlet 112 206 15 0;
#P objectname to_gl.nurbs;
#P comment 366 280 67 9109513 from gl.render;
#P number 300 158 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 215 -27 42 9109513 < < reset;
#P message 516 57 90 9109513 read key3.jxf , bang;
#B color 5;
#P objectname rd;
#P message 449 57 65 9109513 write key3.jxf;
#B color 5;
#P objectname wr;
#P newex 135 107 60 9109513 t b l;
#P newex 186 388 27 9109513 t b l;
#P newex 387 562 146 9109513 pack setcell 1 1 val 0. 0.;
#B color 5;
#P newex 490 517 48 9109513 gate;
#P newex 490 491 34 9109513 < 0.5;
#P newex 586 313 45 9109513 zl slice 2;
#P message 548 266 31 9109513 dump;
#P newex 586 170 146 9109513 t l reset clear;
#B color 5;
#P newex 586 240 131 9109513 zl rot 2;
#B color 5;
#P newex 586 263 131 9109513 Ltocoll;
#B color 5;
#N coll keystone2 1;
#P newobj 586 291 77 9109513 coll keystone2 1;
#B color 5;
#P newex 586 216 100 9109513 pack 0. 0. 0 0;
#B color 5;
#P newex 199 132 170 9109513 jit.matrix 2 float32 @dim 3 2 @adapt 0;
#P newex 586 193 131 9109513 jit.iter;
#B color 5;
#P newex 119 487 44 9109513 zl slice 2;
#P newex 220 442 44 9109513 togedge;
#P newex 632 367 60 9109513 unpack 0. 0.;
#P newex 591 339 55 9109513 t b l;
#P newex 597 392 27 9109513 f;
#P newex 564 367 60 9109513 unpack 0. 0.;
#P newex 547 392 27 9109513 f;
#P newex 569 454 120 9109513 expr sqrt($f1*$f1+$f2*$f2);
#P newex 634 427 58 9109513 expr $f1-$f2;
#P newex 569 428 58 9109513 expr $f1-$f2;
#P newex 434 299 89 9109513 route screentoworld;
#P newex 186 365 105 9109513 route mouse mouseidle;
#P newex 186 418 44 9109513 zl slice 2;
#N vpatcher 45 100 254 214;
#P outlet 80 55 15 0;
#P inlet 80 33 15 0;
#P connect 0 0 1 0;
#P pop;
#P newobj 434 343 42 9109513 p thru;
#P message 119 511 91 9109513 screentoworld $1 $2;
#P newex 198 158 100 9109513 jit.op @op * @val 20;
#P newex 112 182 80 9109513 prepend ctlmatrix;
#P button 198 -27 15 5;
#P newex 199 -5 406 9109513 jit.gl.gridshape doom @shape plane @dim 3 2
@automatic 0 @matrixoutput 1 @poly_mode 1 1;
#P button 16 372 15 0;
#P window linecount 4;
#P newex 0 398 170 9109513 jit.gl.gridshape doom @shape circle @scale 0.05
0.05 @automatic 0 @depth_enable 1 @dim 10 10 @name mee2 @color 0. 0. 1. 0.7;
#P window linecount 3;
#P newex 198 182 151 9109513 jit.gl.multiple doom 2 @targetname mee2
@glparams position color @automatic 0 @position 0. 0. 0.01;
#B color 5;
#P window linecount 2;
#P comment 369 491 115 9109513 on click , find nearest point and changes
its location;
#P window linecount 1;
#P comment 194 538 100 9109513 to gl.render;
#P comment 29 386 47 9109513 to gl.nurb;
#P window setfont "Sans Serif" 36.;
#P comment 266 -68 171 9109540 keystone2;
#P window setfont "Sans Serif" 12.;
#P comment 407 57 39 9109516
#P connect 7 0 6 0;
#P connect 28 0 77 0;
#P connect 86 0 87 0;
#P connect 78 0 79 0;
#P connect 55 0 78 0;
#P connect 56 0 55 0;
#P fasten 87 0 55 0 37 -17 91 -17;
#P connect 28 0 10 0;
#P connect 10 0 46 0;
#P connect 55 0 54 0;
#P fasten 15 1 26 0 238 475 124 475;
#P fasten 14 0 12 0 191 507 124 507;
#P connect 26 0 12 0;
#P connect 12 0 73 0;
#P connect 49 0 54 1;
#P connect 38 0 40 0;
#P connect 55 0 64 0;
#P connect 58 0 64 1;
#P fasten 64 0 15 0 173 362 191 362;
#P connect 15 0 39 0;
#P connect 39 1 14 0;
#P connect 83 0 9 0;
#P connect 69 0 9 0;
#P connect 28 0 11 0;
#P connect 11 0 5 0;
#P connect 54 0 5 0;
#P connect 9 0 8 0;
#P connect 8 0 52 0;
#P connect 52 0 50 0;
#P connect 50 0 66 0;
#P fasten 42 0 28 0 521 131 204 131;
#P connect 40 0 28 0;
#P connect 40 1 28 0;
#P fasten 41 0 28 0 454 130 204 130;
#P connect 66 0 28 0;
#P connect 14 1 25 0;
#P connect 25 0 63 0;
#P connect 25 1 63 0;
#P connect 72 0 63 0;
#P connect 44 0 11 1;
#P connect 67 0 66 1;
#P connect 53 0 52 1;
#P connect 51 0 50 1;
#P connect 88 0 51 0;
#P connect 83 1 67 0;
#P connect 61 0 5 1;
#P connect 57 0 53 0;
#P fasten 39 0 38 0 191 413 392 413;
#P connect 13 0 74 0;
#P connect 74 0 76 0;
#P connect 62 0 60 0;
#P connect 63 0 62 0;
#P fasten 51 0 57 0 405 72;
#P fasten 37 0 38 1 495 549 419 549;
#P connect 51 0 70 0;
#P connect 53 0 70 0;
#P fasten 44 0 70 0 372 173;
#P connect 67 0 70 0;
#P connect 59 0 16 0;
#P connect 16 0 65 0;
#P connect 65 0 13 0;
#P connect 13 0 62 1;
#P connect 74 1 75 0;
#P connect 75 0 76 1;
#P connect 84 0 82 0;
#P connect 82 0 81 0;
#P connect 85 0 81 0;
#P connect 81 0 83 0;
#P connect 80 0 81 1;
#P fasten 19 0 36 0 574 477 495 477;
#P connect 36 0 37 0;
#P connect 76 0 38 4;
#P fasten 35 0 37 1 591 335 533 335;
#P connect 23 0 20 0;
#P connect 25 0 34 0;
#P fasten 13 0 21 0 439 364 569 364;
#P connect 21 0 20 1;
#P connect 20 0 17 0;
#P connect 17 0 19 0;
#P fasten 28 0 33 0 204 154 591 154;
#P connect 33 0 27 0;
#P connect 27 0 29 0;
#P connect 29 0 32 0;
#P connect 33 1 31 0;
#P connect 32 0 31 0;
#P connect 31 0 30 0;
#P fasten 33 2 30 0 727 286 591 286;
#P fasten 34 0 30 0 553 287 591 287;
#P connect 30 0 35 0;
#P fasten 35 1 23 0 626 335 596 335;
#P connect 23 0 22 0;
#P connect 21 1 22 1;
#P fasten 24 0 17 1 637 416 622 416;
#P connect 23 1 24 0;
#P connect 22 0 18 0;
#P connect 27 1 29 2;
#P fasten 18 0 19 1 639 451 684 451;
#P connect 24 1 18 1;
#P pop;
#P newobj 112 194 85 9109518 p keystone2;
#B color 6;
#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P newex 72 227 252 9109513 jit.gl.nurbs doom @dim 5 5 @order 0 0 @ctlshow 0
@color 1. 1. 1. @automatic 0 @scale 1. 1. @name secondsketch;
#P objectname jit.gl.nurbs;
#P window linecount 1;
#P newex 65 94 60 9109513 s render1;
#P message 65 74 161 9109513 usetexture targetx , to_texture , erase;
#P newex 98 155 193 9109513 jit.gl.texture doom @name targetx @adapt 1;
#P inlet 46 30 15 0;
#P connect 0 0 7 0;
#P connect 7 0 6 0;
#P connect 6 0 12 0;
#P connect 12 0 10 0;
#P connect 11 0 10 0;
#P connect 7 1 2 0;
#P connect 2 0 3 0;
#P connect 12 1 11 0;
#P fasten 5 0 4 0 117 224 77 224;
#P fasten 1 0 4 0 103 210 77 210;
#P fasten 9 0 8 0 335 294 91 294;
#P connect 12 2 8 0;
#P fasten 6 4 1 0 103 145 103 145;
#P fasten 6 3 5 0 90 191 117 191;
#P connect 13 0 9 0;
#P pop 1;
#P newobj 61 224 56 9109513 p Keystone;
#P window setfont "Sans Serif" 10.;
#P window linecount 2;
#P comment 46 275 238 9109514 press Q to turn keystone on. only for demo
purpose , some things are turned of;
#P user panel 57 221 64 28;
#X brgb 191 191 191;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P connect 7 0 6 0;
#P connect 6 0 5 0;
#P fasten 8 0 3 0 91 121 45 121;
#P connect 5 2 3 0;
#P connect 5 0 3 0;
#P fasten 13 0 3 0 140 121 45 121;
#P connect 5 1 9 0;
#P connect 9 0 2 0;
#P connect 9 1 10 0;
#P fasten 4 1 11 0 172 169 178 169;
#P fasten 3 1 12 0 115 143 186 143;
#P window clipboard copycount 14;


Viewing 1 post (of 1 total)