jit.gl.videoplane scale and position issues
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 jit.gl.videoplane 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 jit.gl.videoplane 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 jit.gl.render (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.
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.
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.
can you post a very simple example of your problem?
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
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
5 years later the reply remains the same, post what you've tried.
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,
sorry, it's not clear to me what you are asking about.
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
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
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.
Sorry but i don't understand what you mean, i'm not very skilled with jitter.. You talk about a hit.alphablend maybe?
something like this:
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.