Maths Help Matrices / projection transformation - HotUKDeals
We use cookie files to improve site functionality and personalisation. By continuing to use HUKD, you accept our cookie and privacy policy.
Get the HUKD app free at Google Play

Search Error

An error occurred when searching, please try again!

Login / Sign UpSubmit

Maths Help Matrices / projection transformation

moulez Avatar
7y, 5m agoPosted 7 years, 5 months ago
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
moulez Avatar
7y, 5m agoPosted 7 years, 5 months ago
Options

All Comments

(9) Jump to unreadPost a comment
Comments/page:
#1
yer me too

and thats the problem i am supposed to know this :(
#2
starsparkle2311
whoosh, that went over my head so fast, I fell off my chair,lol


yeah me too just readin it does my head in :?
#3
First you need to calculate a homography that will map between your two planes - the physical and the projected image plane. I use the OpenCV software to do this which has a function cvGetPerspectiveTransform which you feed a set of corresponding points in each plane (i.e. a square in your image and the points it projects to in the real world. You can then use the calculated homography to correct your image so that is square when projected.

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
#4
dont drink any of tese when your tryin to sort it out

http://www.hotukdeals.com/item/433711/bulmers-pear-cider-5-00-per-box-of-/
#5
jonsend tats just making it worse cant handle it gotta goto another thread
#6
If you need more detail or some code I will put some up later but a bit busy atm.
#7
Jonsend firstly thanks for the post its really appreciated

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
#8
Jonsend just read your other message

that would be great

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

thanks again
#9
ok np

Post a Comment

You don't need an account to leave a comment. Just enter your email address. We'll keep it private.

...OR log in with your social account

...OR comment using your social account

Thanks for your comment! Keep it up!
We just need to have a quick look and it will be live soon.
The community is happy to hear your opinion! Keep contributing!