crop and rotate

Apr 12, 2006 at 3:32am

crop and rotate

Someone please help me – my Jitter is rusty and I’m trying to do something that for the life of me I can’t seem to get to work. I’m trying to arbitrarily crop images on the fly, then rotate and scale only the cropped portion using jot.rota, filling the rest of the window with black (or folded or wrapped versions of the cropped image). I’ve tried cropping by sending the same srcrect and dstrect params to jit.qt but when I then send the video to jit.rota it scales and rotates the original 320×240 shape, including the cropped black parts. I tried jit.submatrix and that did the scaling and rotating as I wanted but the image is chewed up.
anyone? thanks,-bob

#25375
Apr 12, 2006 at 3:49am

are you setting @usersrcdim 1 with jit.matrix, otherwise sending
srcdimstart/srcdimend wont work. I imagine that would be the
preferred way to do it though.

v a d e //

http://www.vade.info
abstrakt.vade.info

#74656
Apr 12, 2006 at 12:14pm

Hi Vade,
Thanks for the response but thats not the problem – I am setting @usersrcdim 1 and the matrix *is* cropping properly. The problem is that when I then send the stream to jit.rota and scale and rotate, I can’t fill the screen with rotated/scaled versions of the cropped area. What is rotated and scaled is the “full” 320×240 image including the black boxes around the cropped area.
SoftVNS has an actual crop object and when I use that (instead of using a Jitter option) and send that stream to the softVNS rotate object the image scales and rotates within the cropped rectangle – ie the corners get clipped when the image is rotated slightly. The cropped area is like a window that the image scales and rotates within – I want it to use the whole 320×240 space.

#74657
Apr 12, 2006 at 12:29pm

could you post a patch to the list? there may be an error you aren’t
noticing and that we might catch.

best,
jonathan

#74658
Apr 12, 2006 at 1:07pm

look at the boundmode attributes in jit.rota. 2 and 4 may be what
youre looking for.

#74659
Apr 12, 2006 at 4:57pm

Here’s a simplified version of the patch.

max v2;
#N vpatcher 318 84 896 755;
#P comment 297 305 132 196617 Step 4: Change boundmode to 2 or 4 – note black space between cropped images;
#P comment 313 252 132 196617 Step 3: Rotate and scale movie;
#P comment 356 91 46 196617 bottom;
#P comment 317 91 29 196617 right;
#P comment 278 91 29 196617 top;
#P comment 410 107 132 196617 Step 2: Crop movie by changing ltrb bounds. Hit clear to remove old pixels;
#P message 452 181 32 196617 clear;
#P number 200 306 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 200 327 71 196617 boundmode $1;
#P flonum 90 251 45 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 90 272 45 196617 theta $1;
#P flonum 201 225 66 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 223 252 45 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 160 252 45 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 223 272 58 196617 zoom_y $1;
#P message 160 272 58 196617 zoom_x $1;
#P user jit.pwindow 42 398 322 242 0 1 0 0 1 0;
#P newex 43 361 41 196617 jit.rota;
#B color 5;
#P message 147 68 28 196617 stop;
#P flonum 179 47 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 179 68 42 196617 rate $1;
#P message 116 68 28 196617 read;
#P flonum 72 47 35 9 0.5 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 38 47 15 0;
#P newex 38 67 44 196617 metro 2;
#P newex 43 225 103 196617 jit.qt.movie 320 240;
#P newex 216 138 160 196617 pak srcrect 0 0 320 240;
#P number 239 112 35 9 0 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 276 112 35 9 0 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 313 112 35 9 0 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 350 112 35 9 0 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 218 188 160 196617 pak dstrect 0 0 320 240;
#P number 255 167 35 9 0 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 292 167 35 9 0 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 329 167 35 9 0 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 366 167 35 9 0 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 76 161 72 196617 usesrcrect $1;
#P toggle 76 139 15 0;
#P message 111 142 71 196617 usedstrect $1;
#P toggle 111 120 15 0;
#P comment 245 59 100 196617 Step 1: Load Movie;
#P comment 239 91 29 196617 left;
#P connect 18 0 17 0;
#P connect 15 0 16 0;
#P connect 10 0 16 0;
#P connect 5 0 16 0;
#P connect 3 0 16 0;
#P fasten 23 0 16 0 152 94 48 94;
#P fasten 21 0 16 0 184 94 48 94;
#P fasten 20 0 16 0 121 94 48 94;
#P fasten 17 0 16 0 43 99 48 99;
#P fasten 35 0 16 0 457 216 186 216 186 197 48 197;
#P connect 16 0 24 0;
#P connect 33 0 24 0;
#P connect 27 0 24 0;
#P connect 26 0 24 0;
#P connect 31 0 24 0;
#P connect 24 0 25 0;
#P connect 19 0 17 1;
#P connect 4 0 5 0;
#P connect 32 0 31 0;
#P connect 2 0 3 0;
#P fasten 30 0 28 0 206 246 165 246;
#P connect 28 0 26 0;
#P connect 22 0 21 0;
#P connect 34 0 33 0;
#P fasten 30 0 29 0 206 246 228 246;
#P connect 29 0 27 0;
#P connect 14 0 15 1;
#P connect 14 0 9 0;
#P connect 9 0 10 1;
#P connect 13 0 15 2;
#P connect 13 0 8 0;
#P connect 8 0 10 2;
#P connect 12 0 15 3;
#P connect 12 0 7 0;
#P connect 7 0 10 3;
#P connect 11 0 15 4;
#P connect 11 0 6 0;
#P connect 6 0 10 4;
#P pop;

#74660
Apr 12, 2006 at 5:14pm

Bob,

You need to keep your dstrect dimensions at 0 0 320 240.

Adam

#74661
Apr 12, 2006 at 5:20pm

Sorry, that last post wasn’t right.

Adam

#74662
Apr 13, 2006 at 3:45am

try jit.submatrix :

#P user jit.pwindow 75 218 82 62 0 1 0 0 1 0;
#P user jit.pwindow 58 122 82 62 0 1 0 0 1 0;
#P window setfont “Sans Serif” 9.;
#P number 359 152 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 322 152 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 285 179 85 196617 pak offset 0 0;
#P number 250 138 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 213 138 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 176 165 85 196617 pak dim 0 0;
#P newex 43 193 207 196617 jit.submatrix @dim 160 120 @offset 80 60;
#P window linecount 2;
#P comment 430 330 132 196617 Step 4: Change boundmode to 2 or 4;
#P comment 446 277 132 196617 Step 3: Rotate and scale movie;
#P window linecount 3;
#P comment 410 107 132 196617 Step 2: crop movie with jit.submatrix.
offset and dimsize needed;
#P number 333 331 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P message 333 352 71 196617 boundmode $1;
#P flonum 223 276 45 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 223 297 45 196617 theta $1;
#P flonum 334 250 66 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 356 277 45 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 293 277 45 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 356 297 58 196617 zoom_y $1;
#P message 293 297 58 196617 zoom_x $1;
#P user jit.pwindow 42 398 322 242 0 1 0 0 1 0;
#P newex 43 361 41 196617 jit.rota;
#B color 5;
#P message 147 68 28 196617 stop;
#P flonum 179 47 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 179 68 42 196617 rate $1;
#P message 116 68 28 196617 read;
#P flonum 72 47 35 9 0.5 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 38 47 15 0;
#P newex 38 67 44 196617 metro 2;
#P newex 43 102 103 196617 jit.qt.movie 320 240;
#P comment 245 59 100 196617 Step 1: Load Movie;
#P connect 23 0 9 0;
#P connect 23 0 31 0;
#P fasten 15 0 13 0 339 271 298 271;
#P fasten 15 0 14 0 339 271 361 271;
#P connect 1 0 23 0;
#P connect 1 0 30 0;
#P connect 24 0 23 0;
#P connect 27 0 23 0;
#P connect 25 0 24 1;
#P connect 26 0 24 2;
#P connect 28 0 27 1;
#P connect 29 0 27 2;
#P connect 14 0 12 0;
#P connect 19 0 18 0;
#P connect 7 0 6 0;
#P connect 13 0 11 0;
#P connect 17 0 16 0;
#P connect 4 0 2 1;
#P connect 9 0 10 0;
#P connect 16 0 9 0;
#P connect 11 0 9 0;
#P connect 12 0 9 0;
#P connect 18 0 9 0;
#P fasten 2 0 1 0 43 99 48 99;
#P fasten 5 0 1 0 121 94 48 94;
#P fasten 6 0 1 0 184 94 48 94;
#P fasten 8 0 1 0 152 94 48 94;
#P connect 3 0 2 0;
#P window clipboard copycount 32;

#74663

You must be logged in to reply to this topic.