Forums > Jitter scale and position issues

Jan 03 2011 | 12:40 am

I know I am missing something fundamental. I have been banging my head against a wall and I don’t seem to be able to find the answer…

I use to display a picture (eventually video). Fine so far.
I then cut out a piece of the original jit.matrix using "srcdim" end "dstdim" and store that in a new matrix of the new size. Also fine.

I now put that small cutout into a and display it on top of the original videoplane. I would like it to be at the exact position and scale of the original so that initially no one can tell there is an overlay happening. This way I can gradually change certain aspects of the picture and rearrange them as well later on.

This is where I lose it. I have exact coordinates of the cutout but in screencoordinates. I use (bound to my context) to convert this to world coordinates. I guess that’s fine too. The scale however I am lost with.

I am attaching what I have so far. If someone could have a look and give me some pointers, maybe refer me to some tuts I overlooked. I am really lost right now and any help will be greatly appreciated!!!

Thanks in advance.

-- Pasted Max Patch, click to expand. --

Jan 04 2011 | 7:54 pm

you might want to try the orthographic projection (@ortho 1 or 2 on your gl.render).
you can also try @transform_reset 1 or 2 on your gl.videoplanes.

Jan 04 2011 | 8:08 pm

thanks. the ortho 2 message was very helpful.
I figured out how to do the scaling. was much easier than I thought. but the translation from screen to world coordinates for the location of my rect still bothers me.
What I do right now is calculate the center of my rect, then use "screentoworld $1 $2" to get it converted. Unfortunately, what I get out of it isn’t even close to where the rect should be.
Am I missing a crucial step here?

apologies, but gl is self-thought and that has been a while. I didn’t use it, now I lost it :(

Thanks for any insights.

Jan 06 2011 | 9:51 pm

can you post a very simple example of your problem?

Jan 08 2011 | 7:47 pm

I tried to isolate the problem, and wouldn’t you know, when I simplify it it goes away!!! driving me bonkers because I still can’t see how my main patch is different. Well, gonna go bug hunting for the weekend I guess :(

thanks for your help

Jun 29 2016 | 4:18 pm

Sorry for re-opening this old thread but i’m stuck with the same problem and i can’t fix it, can you please MIB tell me how you get it to work? i don’t understand how to scale the position, i found a way to scale the dimension of the selection visualized above the image but the position is making me go crazy…
Thanks in advance

Jun 30 2016 | 7:53 am

5 years later the reply remains the same, post what you’ve tried.

Jul 01 2016 | 7:31 am

Sorry for late, i make the scale and position, it’s not the best way to do it i think but it works, now i would like to be able to select a part of the source matrix not only from start, i post what i got,

  1. Photo_photo.maxpat
Jul 01 2016 | 10:56 am

sorry, it’s not clear to me what you are asking about.

Jul 01 2016 | 3:50 pm

Sorry, i try to explain..
What i would like to do is isolate a part of the source matrix non only starting from the left(so as now) but for example isolate the center then visualize it on top of the original, hope that make sense for you.
Now the selection is from 0 to 80 x 240 what i would like to do is a selection like from 80 to 120x 240

Jul 03 2016 | 4:30 pm

I worked on it, and found the issues, i now can select a portion of matrix and visualize it on top of the first matrix, but the scale i make isn’t so precise, it’s still a bit out of sync, have you an idea about i can do a more precise scale? i post my patch

— Pasted Max Patch, click to expand. —
Jul 05 2016 | 9:01 am

nice solution. this looks pretty sound to me and i don’t think you will get much more precision.

you could try applying an alpha mask to the top videoplane that fades out it’s edges.

Jul 05 2016 | 4:10 pm

Sorry but i don’t understand what you mean, i’m not very skilled with jitter.. You talk about a hit.alphablend maybe?

Jul 06 2016 | 8:44 am

something like this:

— Pasted Max Patch, click to expand. —
Jul 06 2016 | 4:27 pm

Wow that’s amazing, thank you! Now it seems really precise, i never knew about a way to do it… But now there’s a problem, when i fade out the top matrix with jit.scalebias, the portion remains black, there’s no image under.

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

Forums > Jitter