Re: corner pin adjustement of plane/quad with videotexture?


Forums > Jitter > corner pin adjustement of plane/quad with videotexture?
August 28, 2011 | 11:45 am

hi there,
i have a solution for you, BUT:
it is a bit difficult to share, since it has two major dependencies.
first, you need thomas grill´s python skripting objects from http://grrrr.org/research/software/ (that is easy)
second, you need a working opencv installation with python bindings: http://opencv.willowgarage.com/wiki/

i did this a year ago or so for an exhibition, and since then i was thinking about doing this whith a shareable external, never had the time to do so.
as eric pointed out, the problem is that what you guys do with the "mesh" or "nurbs" approach is a linear distortion of the movie, and what you want to do is a perspective transformation.
opencv has this wonderful function "findHomography" that does our math – finding the transformation matrix from a given set of points.

so the attached patch does exactly that: we know the "source points" (e.g a square), we can set the destination points (by draging the sliders), opencv (inside the python script) calculates the transformation matrix.

then i use this matrix to draw a transformed vidplane – with gl.sketch.
basically like this:
glmatrixmode perspective,
glmultmatrix TRANSFORM,
drawobject MOVIE #that´s the jit.gl.videoplane

so for all of you who have python and opencv running in your max environment (or are willing to set it up) please test this.
i am in the process of final mixdown and mastering of my upcoming album (yippieyeah !), so i am a bit short on time. still, i will try to come up with an external that has no dependencies for easier sharing.

yours truly,
hons