Sign in to follow this  

Projective Line Creating Matrix

This topic is 4731 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, I'm not sure if I'm asleep or if this is as hard as my brain thinks, but either way... I have a 3x3 matrix, you multiply a homogenous point by it and out pops a vector that represents a 2D line. i.e. F*P = L Where F is a 3x3 matrix, P is (x,y,1), and L is (u,v,w) where the line formular is u*a + v*b + w = 0, for any point (a,b) on the line. (Incase it makes the problem easier its a rank 2 matrix.) Problem is the point it currently takes is in the space [-1,1] x [-1,1], and it then outputs the line such that it maps to the same space - I want to change it so it uses a different space - [0,width]x[0,width] where width happens to be the width of the image i'm proccessing. (Its a square image, which is why ive put width twice.) Essentially for it to currently work I have to normalise the image coordinates, I want to remove that requirement. Anyone have the foggiest? Thanks in advance:-) Lethe

Share this post


Link to post
Share on other sites
You want it to take [0,width]x[0,width] at input?
It is very easy, you just need

F*A*P'=L

where P' is vector in [0,width]x[0,width] , A is matrix that does scaling and offset.

A=
2/width, 0, -1
0, 2/width, -1
0, 0, 1

So you can use
F'=F*A
F'*P'=L

(BTW, your question is somewhat hard to read. In math, 'space' mean different thing, AFAIK)

(for some other people around there: obviously instead of doing full matrix multiply you can write special routine that doesn't multiply with zeroes, but i doubt it is useful, and inlining compiler with optimization should do it anyway)

Share this post


Link to post
Share on other sites
Thanks, though I got that part. (I spent about 2 hours trying to get this to work before comming here:-( ) Theres the other half as well though, and thats the bit that has me stuck - which is I also want the output transformed by the inverse of that matrix, except for a line thats the result of that multipication, so yea basic matrix multipication isn't going to work. I just specified it as one problem as, well, it is;-) I'm also fairrly sure that theres a clever way of doing it as the paper I'm taking it from implies as much, without going into any detail. (Something to do with the rank 2 constraint and a null space, whatever that means.)

Your right about the spaces though - its very easy to make assumptions when writting maths which others won't make, but you got the right interpretation:-)

Cheers anyway.

Lethe

Share this post


Link to post
Share on other sites
I don't really understand your current problem, but if you need to get point from line,
use
P'=inverse(F')*L
and then, as P'.w might not be 1, do homogeneous divide.
(homogeneous divide works kinda as it's own inverse)

Share this post


Link to post
Share on other sites
AFAIK, a line in 2D space is a 3-dimensional object, so cannot be produced with a matrix of rank 2, unless you are expecting only lines from a subspace of line space (I mean, not all lines you can get).
(x,y,1) is a 2D point, so how could it represent a line (before or after transforming).

You mentioned you were using some book, could you post some formulas of the matrix, or the general idea covered? Cause AFAI understand, the problem is not solvable.

/def

Share this post


Link to post
Share on other sites
I've come to the conclusion that it was probably a bad idea to post that question - it was fairrly late, problem was annoying me etc:-) I should wait till the Christmas holiday is over and I can talk to someone at my uni, problem is I'm going to keep trying to solve it till then, cos I'm like that..

Anyway, your right in that it won't produce all lines - the matrix in question is formularly refered to as the fundamental matrix, which expresses the epipolar relationship between two images. (...) Its to do with stereo corrispondance - if you have two pictures of a scene then any point you select in one image can *only* map to the set of points along a line in the other image, so instead of trying to map points in one image to any point in the other your restricted to searching just that line. The fundamental matrix takes a point in the first image and converts it into the line to search along in the other image. Because all these so-called epipolar lines all go through one point, known as the epipolar point the matrix is rank 2. If you want to know more go read http://www.cs.unc.edu/%7Emarc/tutorial.pdf, but I'll warn you, its not a light read - I concider myself to be fairrly proficiant at maths and there are entire sections in there I don't understand:-) (Incase your wondering, this isn't directly games related, but what I want to do with the output, when it finally works, is... And I was kinda hoping someone here would enjoy the challenge.)

Thanks for reading,

Lethe

Share this post


Link to post
Share on other sites

This topic is 4731 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this