Groups

# Maths Help Matrices / projection transformation

Hey guys

Thought i would put this one out there as you lot seem like a bunch of clever people.

I am having some trouble with a project i am working on and the maths is killing me

basically i have a projector which is pointed at different angles to a screen and i need to correct the skew - keystone effects via software

i can get the corner coordinates of the polygon that appears on the screen and i can get x.y.z roll pitch, yaw of the projector

i have looked and projection matrices look like the way but i have no idea what so ever on how to make them work

if anyone has any ideas i would be much much appreciative

thanks

Thought i would put this one out there as you lot seem like a bunch of clever people.

I am having some trouble with a project i am working on and the maths is killing me

basically i have a projector which is pointed at different angles to a screen and i need to correct the skew - keystone effects via software

i can get the corner coordinates of the polygon that appears on the screen and i can get x.y.z roll pitch, yaw of the projector

i have looked and projection matrices look like the way but i have no idea what so ever on how to make them work

if anyone has any ideas i would be much much appreciative

thanks

Original Poster

and thats the problem i am supposed to know this

yeah me too just readin it does my head in :?

From the source code: Calculates coefficients of perspective transformation

which maps (xi,yi) to (ui,vi), (i=1,2,3,4):

c00*xi + c01*yi + c02

ui = ---------------------

c20*xi + c21*yi + c22

c10*xi + c11*yi + c12

vi = ---------------------

c20*xi + c21*yi + c22

Coefficients are calculated by solving linear system:

/ x0 y0 1 0 0 0 -x0*u0 -y0*u0 \ /c00\ /u0\

| x1 y1 1 0 0 0 -x1*u1 -y1*u1 | |c01| |u1|

| x2 y2 1 0 0 0 -x2*u2 -y2*u2 | |c02| |u2|

| x3 y3 1 0 0 0 -x3*u3 -y3*u3 |.|c10|=|u3|,

| 0 0 0 x0 y0 1 -x0*v0 -y0*v0 | |c11| |v0|

| 0 0 0 x1 y1 1 -x1*v1 -y1*v1 | |c12| |v1|

| 0 0 0 x2 y2 1 -x2*v2 -y2*v2 | |c20| |v2|

\ 0 0 0 x3 y3 1 -x3*v3 -y3*v3 / \c21/ \v3/

where:

cij - matrix coefficients, c22 = 1

hotukdeals.com/ite…f-/

Original Poster

my problem is i am doing it on a mobile device using python so i wont have access to openCV or openGL or any lovely utilities

so from what you posted if i calculate the matrix with the values I obtain it just works it out

also i am new to matrix miltiplication and obviously extrapolating that to code is quite a task

so to get this working what values would i need to know

and what is x,y and u,v

the coeficents ci how are they calcualted in this as they arent the end product

/ x0 y0 1 0 0 0 -x0*u0 -y0*u0 \ /c00\ /u0\

| x1 y1 1 0 0 0 -x1*u1 -y1*u1 | |c01| |u1|

| x2 y2 1 0 0 0 -x2*u2 -y2*u2 | |c02| |u2|

| x3 y3 1 0 0 0 -x3*u3 -y3*u3 | .|c10| |u3|,

| 0 0 0 x0 y0 1 -x0*v0 -y0*v0 | |c11| = |v0|

| 0 0 0 x1 y1 1 -x1*v1 -y1*v1 | |c12| |v1|

| 0 0 0 x2 y2 1 -x2*v2 -y2*v2 | |c20| |v2|

\ 0 0 0 x3 y3 1 -x3*v3 -y3*v3 / \c21/ \v3/

again apologies if this is simple stuff i really am in the dark with this area

thanks again

Original Poster

that would be great

I will pm you my email address if thats ok to save the code loosing its integrity

thanks again