Forums > Jitter

Distorting a matrix?

September 15, 2006 | 5:44 am

Hi everyone!

First off, I’d like to introduce myself. I’m a student at a local Singaporean university and I’m enrolled in an interactive media course. My current term project is to create a distortable live-feed video (of someone’s face), and I’ve been stymied by the steps required.

My first experiment is cutting the feed up into a grid of 3×3 matrices (@rows 3, @colums 3) and then distorting each of them with zoom. However this presents several problems:

1. Each cell created with scissors is of a fixed matrix dimension (I’m using 160 x 120 for now), and if I distort the video, the maximum viewable area of the matrix doesn’t change, so it gets cut off.

2. If I expand the matrix size and adjust the initial settings, I can distort the image to my liking but the 3×3 display glues together incorrectly with lots of dead space at the default settings.

Is there any way of actually adjusting/resizing the matrix itself in real time, or am I doing it all wrong to begin with? (Actually I think I’m doing it wrong.) I’ve only had a month’s experience with this and I can’t find anything in the tutorials/documentation that might help.

The final program will be hooked up to IR or Motion sensors embedded in a surface so when a hand moves over them they will track the movement and ‘drag’ the matrix along accordingly. There will be a blue screen, so after chromakeying there won’t be a background to bother with.

Thanks for any help given,
Cheers!


September 15, 2006 | 6:33 pm

Hi Wong,

I would suggest you look at jit.repos, and generate a spatial
displacement matrix for whatever effect you’re looking to achieve.
Check out the examples under jitter-examples/video/spatial.

Otherwise, if you do want to follow the scissors glue route or some
other strategy, you’ll need to actually post a simple patch which
illustrates your desired effect and problems achieving said effect.
Given the information provided, there’s no much insight we can provide.

-Joshua


September 16, 2006 | 11:28 am

in addition to what joshua suggested, you might want to check this out:

#P window setfont Geneva 14.;
#P window linecount 1;
#P comment 228 188 155 9961486 3. draw in pwindow:;
#P comment 591 113 155 9961486 2. generate a brush;
#P window setfont Geneva 9.;
#N vpatcher 123 136 723 536;
#P window setfont Geneva 9.;
#P newex 68 107 20 9961481 t b;
#P newex 68 132 112 9961481 jit.matrix 4 char 64 64;
#P newex 68 157 381 9961481 jit.expr @dim 64 64 @expr
"1-hypot((norm[0]*2.0 – 1.0) \, (norm[1]*2.0 – 1.0))";
#P outlet 68 331 15 0;
#P inlet 68 39 15 0;
#P connect 0 0 4 0;
#P connect 4 0 3 0;
#P connect 3 0 2 0;
#P connect 2 0 1 0;
#P pop;
#P newobj 591 188 41 9961481 p brush;
#N vpatcher 15 55 716 448;
#P window setfont Geneva 9.;
#P newex 137 80 53 9961481 match 1 0;
#P newex 139 289 30 9961481 gate;
#P newex 23 101 21 9961481 t 0;
#P newex 23 80 53 9961481 match 0 1;
#P newex 78 100 21 9961481 t 1;
#P newex 78 79 53 9961481 match 1 1;
#P newex 201 182 27 9961481 !-;
#P newex 159 182 27 9961481 !-;
#P newex 214 151 27 9961481 t i i;
#P newex 159 152 27 9961481 t i i;
#P newex 70 39 41 9961481 zl nth 1;
#P newex 159 129 65 9961481 unpack 0 0;
#P number 551 80 35 9 0 0 0 152 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 552 107 27 9961481 / 2;
#P newex 380 212 65 9961481 pack 0 0;
#P newex 380 162 65 9961481 unpack 0 0;
#P newex 435 187 27 9961481 – 32;
#P newex 380 187 27 9961481 – 32;
#P newex 159 264 63 9961481 prepend gain;
#P newex 159 234 52 9961481 pack 0. 0.;
#P newex 472 193 65 9961481 pack 0 0;
#P newex 472 143 65 9961481 unpack 0 0;
#P newex 472 221 90 9961481 prepend dstdimend;
#P newex 380 249 98 9961481 prepend dstdimstart;
#P newex 527 168 29 9961481 + 32;
#P newex 472 168 29 9961481 + 32;
#P newex 380 119 38 9961481 t l l;
#P newex 316 65 106 9961481 t b b l clear;
#P newex 316 41 41 9961481 route 1;
#P inlet 70 19 15 0;
#P outlet 348 87 15 0;
#P outlet 279 317 15 0;
#P outlet 139 311 15 0;
#P connect 22 0 29 0;
#P connect 29 0 30 0;
#P connect 32 0 30 0;
#P connect 3 0 22 0;
#P connect 22 0 27 0;
#P connect 27 0 28 0;
#P connect 22 0 32 0;
#P connect 30 0 31 0;
#P connect 28 0 31 0;
#P connect 31 0 0 0;
#P connect 4 0 21 0;
#P connect 21 0 23 0;
#P connect 23 1 25 0;
#P connect 25 0 13 0;
#P connect 13 0 14 0;
#P connect 14 0 31 1;
#P connect 23 0 25 1;
#P connect 24 1 26 0;
#P connect 26 0 13 1;
#P connect 21 1 24 0;
#P connect 24 0 26 1;
#P connect 5 0 1 0;
#P connect 5 3 1 0;
#P connect 10 0 1 0;
#P connect 9 0 1 0;
#P connect 3 0 4 0;
#P connect 4 0 5 0;
#P connect 5 1 2 0;
#P connect 5 2 6 0;
#P connect 6 0 17 0;
#P connect 17 0 15 0;
#P connect 15 0 18 0;
#P connect 18 0 9 0;
#P connect 19 0 15 1;
#P connect 17 1 16 0;
#P connect 16 0 18 1;
#P connect 19 0 16 1;
#P connect 6 1 11 0;
#P connect 11 0 7 0;
#P connect 7 0 12 0;
#P connect 12 0 10 0;
#P connect 19 0 7 1;
#P connect 11 1 8 0;
#P connect 8 0 12 1;
#P connect 19 0 8 1;
#P connect 20 0 19 0;
#P pop;
#P newobj 494 219 88 9961481 p mouse2numbers;
#P message 123 70 96 9961481 read oh.mov , loop 2;
#P newex 571 400 62 9961481 jit.normalize;
#P flonum 669 287 48 9 0 0 0 152 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 572 305 107 9961481 jit.op @op * @val 256.;
#P message 162 123 31 9961481 start;
#P button 591 143 15 0;
#P message 693 310 54 9961481 clear , bang;
#P newex 572 363 80 9961481 jit.glop @mode 1;
#P newex 572 337 332 9961481 jit.matrix 2 float32 320 240 @adapt 0
@usedstdim 1 @thru 0 @interp 1;
#P newex 572 265 211 9961481 jit.matrix 2 float32 64 64 @planemap 1 1 1 1;
#P user jit.pwindow 571 418 322 242 0 1 0 0 1 0;
#P newex 346 552 41 9961481 zl rot 1;
#P newex 346 530 46 9961481 zl slice 3;
#P newex 346 507 63 9961481 route mouse;
#P user jit.pwindow 35 252 322 242 0 1 0 0 1 0;
#P newex 36 227 218 9961481 jit.repos @mode 1 @interpbits 8 @boundmode 4;
#P message 132 123 27 9961481 stop;
#P message 96 123 28 9961481 read;
#P number 54 97 35 9 0 0 0 152 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 36 96 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 36 117 50 9109513 qmetro 5;
#P window setfont Geneva 9.;
#P newex 36 154 133 9961481 jit.qt.movie 320 240 @vol 0;
#P window setfont Geneva 14.;
#P comment 122 48 155 9961486 1. read a movie;
#P connect 3 0 2 0;
#P fasten 22 0 1 0 128 146 41 146;
#P fasten 6 0 1 0 137 146 41 146;
#P fasten 5 0 1 0 101 146 41 146;
#P connect 2 0 1 0;
#P fasten 18 0 1 0 167 146 41 146;
#P connect 1 0 7 0;
#P connect 7 0 8 0;
#P connect 4 0 2 1;
#P fasten 15 0 7 1 577 391 395 391 395 220 249 220;
#P connect 8 1 9 0;
#P fasten 12 1 9 0 887 663 410 663 410 503 351 503;
#P lcolor 12;
#P connect 9 0 10 0;
#P connect 10 0 11 0;
#P fasten 11 0 23 0 351 577 458 577 458 212 499 212;
#P lcolor 1;
#P connect 15 0 21 0;
#P fasten 24 0 13 0 596 254 577 254;
#P connect 23 2 13 0;
#P lcolor 1;
#P connect 13 0 19 0;
#P hidden connect 16 0 14 0;
#P fasten 23 1 14 0 538 326 577 326;
#P lcolor 1;
#P connect 19 0 14 0;
#P hidden connect 16 0 15 0;
#P fasten 23 0 15 0 499 359 577 359;
#P lcolor 1;
#P connect 14 0 15 0;
#P connect 21 0 12 0;
#P connect 17 0 24 0;
#P connect 20 0 19 1;
#P window clipboard copycount 27;

best,
nesa


September 18, 2006 | 1:24 am

Cool. I’ll get my current patch up… been working on it and I think I just found the message box parameter that changes matrix size. Still doesn’t solve my problem but I’ll try the others ASAP.

Thanks!!

max v2;
#N vpatcher 249 82 1246 940;
#P origin -12 -222;
#P user uslider 711 27 24 34 12 10 10 0;
#P user uslider 666 26 24 34 16 10 10 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 881 119 32 196617 print;
#P newex 667 99 55 196617 pak 10 10;
#P message 667 123 58 196617 size $1 $2;
#P newex 771 99 55 196617 pak 10 10;
#P user uslider 816 29 24 34 12 10 10 0;
#P user uslider 771 28 24 34 16 10 10 0;
#P message 771 123 58 196617 size $1 $2;
#N vpatcher 143 129 930 926;
#P origin 137 25;
#P user jit.pwindow 80 359 82 62 0 1 0 0 1 0;
#P outlet 42 450 15 0;
#P inlet 20 292 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 42 320 43 196617 jit.rota;
#P window setfont "Proportional Serif" 10.;
#P comment 282 364 43 131727370 Initialize;
#P comment 247 248 59 131727370 Interpolation;
#P comment 260 175 61 131727370 Anchor point;
#P comment 343 189 13 131727370 y;
#P comment 267 189 13 131727370 x;
#P comment 332 125 13 131727370 y;
#P comment 267 125 13 131727370 x;
#P comment 235 102 32 131727370 Zoom;
#P window setfont "Fixedwidth Serif" 10.;
#P message 297 144 62 1441802 zoom_y $1;
#P message 232 144 62 1441802 zoom_x $1;
#P flonum 267 103 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname zoom;
#P flonum 297 125 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname zoom_y;
#P flonum 231 125 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname zoom_x;
#P toggle 232 249 15 0;
#P objectname interp;
#P message 232 276 62 1441802 interp $1;
#P window linecount 3;
#P message 229 394 340 1441802 setname anchor_x , 0 , setname anchor_y , 161 , setname boundmode , 1 , setname interp , 1 , setname zoom , 1. , setname theta , 0. , setname zoom_x , 1 , setname zoom_y , 1;
#P window linecount 1;
#P newex 229 456 32 1441802 pvar;
#P newex 229 361 53 1441802 loadbang;
#P number 308 189 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname anchor_y;
#P number 232 189 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname anchor_x;
#P message 235 68 74 1441802 boundmode 1;
#P message 308 208 73 1441802 anchor_y $1;
#P message 232 208 74 1441802 anchor_x $1;
#P fasten 2 0 23 0 240 92 47 92;
#P fasten 14 0 23 0 302 172 47 172;
#P fasten 13 0 23 0 237 172 47 172;
#P fasten 1 0 23 0 313 240 47 240;
#P fasten 0 0 23 0 237 240 47 240;
#P fasten 8 0 23 0 237 302 47 302;
#P connect 24 0 23 0;
#P connect 23 0 25 0;
#P connect 23 0 26 0;
#P connect 5 0 7 0;
#P connect 7 0 6 0;
#P fasten 12 0 10 0 272 121 236 121;
#P connect 10 0 13 0;
#P connect 3 0 0 0;
#P connect 9 0 8 0;
#P fasten 5 0 2 0 234 384 376 384 376 48 240 48;
#P fasten 12 0 11 0 272 121 302 121;
#P connect 11 0 14 0;
#P connect 4 0 1 0;
#P pop;
#P newobj 574 112 69 196617 patcher 3-9;
#P user jit.pwindow 546 680 82 62 0 1 0 0 1 0;
#N vpatcher 73 93 860 890;
#P origin 137 25;
#P user jit.pwindow 80 359 82 62 0 1 0 0 1 0;
#P outlet 42 450 15 0;
#P inlet 20 292 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 42 320 43 196617 jit.rota;
#P window setfont "Proportional Serif" 10.;
#P comment 282 364 43 131727370 Initialize;
#P comment 247 248 59 131727370 Interpolation;
#P comment 260 175 61 131727370 Anchor point;
#P comment 343 189 13 131727370 y;
#P comment 267 189 13 131727370 x;
#P comment 332 125 13 131727370 y;
#P comment 267 125 13 131727370 x;
#P comment 235 102 32 131727370 Zoom;
#P window setfont "Fixedwidth Serif" 10.;
#P message 297 144 62 1441802 zoom_y $1;
#P message 232 144 62 1441802 zoom_x $1;
#P flonum 267 103 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname zoom;
#P flonum 297 125 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname zoom_y;
#P flonum 231 125 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname zoom_x;
#P toggle 232 249 15 0;
#P objectname interp;
#P message 232 276 62 1441802 interp $1;
#P window linecount 3;
#P message 229 394 340 1441802 setname anchor_x , 112 , setname anchor_y , 161 , setname boundmode , 1 , setname interp , 1 , setname zoom , 1. , setname theta , 0. , setname zoom_x , 1 , setname zoom_y , 1;
#P window linecount 1;
#P newex 229 456 32 1441802 pvar;
#P newex 229 361 53 1441802 loadbang;
#P number 308 189 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname anchor_y;
#P number 232 189 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname anchor_x;
#P message 235 68 74 1441802 boundmode 1;
#P message 308 208 73 1441802 anchor_y $1;
#P message 232 208 74 1441802 anchor_x $1;
#P connect 24 0 23 0;
#P fasten 8 0 23 0 237 302 47 302;
#P fasten 0 0 23 0 237 240 47 240;
#P fasten 1 0 23 0 313 240 47 240;
#P fasten 13 0 23 0 237 172 47 172;
#P fasten 14 0 23 0 302 172 47 172;
#P fasten 2 0 23 0 240 92 47 92;
#P connect 23 0 25 0;
#P connect 23 0 26 0;
#P connect 5 0 7 0;
#P connect 7 0 6 0;
#P fasten 12 0 10 0 272 121 236 121;
#P connect 10 0 13 0;
#P connect 3 0 0 0;
#P connect 9 0 8 0;
#P fasten 5 0 2 0 234 384 376 384 376 48 240 48;
#P fasten 12 0 11 0 272 121 302 121;
#P connect 11 0 14 0;
#P connect 4 0 1 0;
#P pop;
#P newobj 505 112 69 196617 patcher 2-9;
#P newex 546 603 148 196617 jit.glue @rows 3 @columns 3;
#P user jit.pwindow 771 417 162 122 0 1 0 1 1 0;
#X name u137000065;
#P user jit.pwindow 603 419 162 122 0 1 0 1 1 0;
#X name u358000066;
#P user jit.pwindow 436 419 162 122 0 1 0 1 1 0;
#X name u177000067;
#P user jit.pwindow 771 287 162 122 0 1 0 1 1 0;
#X name u397000068;
#P user jit.pwindow 603 289 162 122 0 1 0 1 1 0;
#X name u294000069;
#P user jit.pwindow 436 289 162 122 0 1 0 1 1 0;
#X name u904000070;
#P user jit.pwindow 770 158 162 122 0 1 0 1 1 0;
#X name u609000071;
#P user jit.pwindow 602 160 93 83 0 1 0 0 1 0;
#X name u231000072;
#P user jit.pwindow 435 160 162 122 0 1 0 0 1 0;
#X name u745000073;
#N vpatcher 15 55 615 455;
#P origin 137 69;
#P user jit.pwindow 80 270 82 62 0 1 0 0 1 0;
#P outlet 42 361 15 0;
#P inlet 20 203 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 42 231 43 196617 jit.rota;
#P window setfont "Proportional Serif" 10.;
#P comment 282 275 43 131727370 Initialize;
#P comment 247 139 59 131727370 Interpolation;
#P comment 260 66 61 131727370 Anchor point;
#P comment 343 80 13 131727370 y;
#P comment 267 80 13 131727370 x;
#P comment 332 16 13 131727370 y;
#P comment 267 16 13 131727370 x;
#P comment 235 -7 32 131727370 Zoom;
#P window setfont "Fixedwidth Serif" 10.;
#P message 297 35 62 1441802 zoom_y $1;
#P message 232 35 62 1441802 zoom_x $1;
#P flonum 267 -6 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname zoom;
#P flonum 297 16 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname zoom_y;
#P flonum 231 16 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname zoom_x;
#P toggle 232 140 15 0;
#P objectname interp;
#P message 232 167 62 1441802 interp $1;
#P window linecount 3;
#P message 229 305 340 1441802 setname anchor_x , 213 , setname anchor_y , 161 , setname boundmode , 1 , setname interp , 1 , setname zoom , 1. , setname theta , 0. , setname zoom_x , 1 , setname zoom_y , 1;
#P window linecount 1;
#P newex 229 367 32 1441802 pvar;
#P newex 229 272 53 1441802 loadbang;
#P number 308 80 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname anchor_y;
#P number 232 80 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname anchor_x;
#P message 235 -41 74 1441802 boundmode 1;
#P message 308 99 73 1441802 anchor_y $1;
#P message 232 99 74 1441802 anchor_x $1;
#P fasten 2 0 23 0 240 -14 47 -14;
#P fasten 14 0 23 0 302 61 47 61;
#P fasten 13 0 23 0 237 61 47 61;
#P fasten 1 0 23 0 313 122 47 122;
#P fasten 0 0 23 0 237 122 47 122;
#P fasten 8 0 23 0 237 204 47 204;
#P connect 24 0 23 0;
#P connect 23 0 25 0;
#P connect 23 0 26 0;
#P connect 5 0 7 0;
#P connect 7 0 6 0;
#P fasten 12 0 10 0 272 12 236 12;
#P connect 10 0 13 0;
#P connect 3 0 0 0;
#P connect 9 0 8 0;
#P fasten 12 0 11 0 272 12 302 12;
#P connect 11 0 14 0;
#P connect 4 0 1 0;
#P pop;
#P newobj 436 112 69 196617 patcher 1-9;
#P newex 436 36 54 196617 r Vidout;
#P newex 270 825 57 196617 send Vidout;
#P newex 436 69 166 196617 jit.scissors @rows 3 @columns 3;
#P user suckah 162 160 214 156;
#P number 62 537 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 21 579 175 196617 pak color 0. 0. 0. 0.;
#P flonum 103 537 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 144 537 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 185 537 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 111 500 71 196617 unpack 0. 0. 0.;
#P newex 111 474 87 196617 vexpr $i1/255.;
#P user jit.pwindow 269 645 214 170 0 1 0 0 1 0;
#P user swatch 270 353 128 32;
#P newex 270 622 79 196617 jit.chromakey;
#P hidden button 163 107 15 0;
#P hidden newex 163 132 105 196617 jit.qt.movie 640 480;
#P hidden newex 163 77 52 196617 metro 40;
#P toggle 163 50 15 0;
#P message 77 26 30 196617 read;
#P window linecount 3;
#P hidden comment 66 235 100 196617 use a suckah to capture colour info from a video;
#P window linecount 5;
#P hidden comment 130 404 100 196617 divides the colour value into a float/int for easy reading. (RGB values can only be input as 0-1);
#P window linecount 2;
#P hidden comment 0 507 100 196617 alpha channel: don’t touch yet;
#P window linecount 4;
#P hidden comment 17 629 197 196617 pak colour packs the numbers into a colour list that chromakey can read (otherwise the RGB scale just sends out a List object which it cannot read);
#P user jit.pwindow 162 160 214 155 0 1 0 0 1 0;
#P user panel 74 22 313 315;
#X brgb 63 217 101;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P hidden connect 20 0 19 1;
#P hidden connect 15 0 18 0;
#P hidden connect 18 0 19 2;
#P hidden fasten 12 0 14 0 275 406 116 406;
#P hidden connect 14 0 15 0;
#P hidden connect 15 1 17 0;
#P hidden connect 17 0 19 3;
#P hidden connect 7 0 8 0;
#P hidden connect 8 0 10 0;
#P hidden connect 6 0 9 0;
#P hidden connect 10 0 9 0;
#P hidden connect 9 0 1 0;
#P hidden connect 15 2 16 0;
#P hidden connect 16 0 19 4;
#P hidden fasten 21 0 12 0 167 346 275 346;
#P hidden fasten 19 0 11 0 26 616 275 616;
#P hidden fasten 9 0 11 0 116 151 116 395 275 395;
#P connect 11 0 13 0;
#P connect 13 0 23 0;
#P connect 24 0 22 0;
#P connect 22 0 25 0;
#P connect 25 0 26 0;
#P connect 22 1 36 0;
#P connect 26 0 35 0;
#P connect 35 0 37 0;
#P connect 27 0 35 1;
#P connect 22 2 38 0;
#P connect 28 0 35 2;
#P connect 36 0 27 0;
#P connect 43 0 27 0;
#P connect 46 0 44 0;
#P connect 44 0 43 0;
#P connect 47 0 44 1;
#P connect 40 0 42 0;
#P connect 42 0 39 0;
#P connect 38 0 28 0;
#P connect 39 0 28 0;
#P connect 41 0 42 1;
#P connect 42 0 45 0;
#P pop;


September 20, 2006 | 12:48 am


Viewing 5 posts - 1 through 5 (of 5 total)