Search code examples
image-processingcameracomputer-vision

Why does fundamental matrix have 7 degrees of freedom?


There are 9 parameters in the fundamental matrix to relate the pixel co-ordinates of left and right images but only 7 degrees of freedom (DOF).

The reasoning for this on several pages that I've searched says :

  1. Homogenous equations means we lose a degree of freedom

  2. The determinant of F = 0, therefore we lose another degree of freedom.

I don't understand why those 2 reasons mean we lose 2 DOF - can someone explain it?


Solution

  • We initially have 9 DOF because the fundamental matrix is composed of 9 parameters, which implies that we need 9 corresponding points to compute the fundamental matrix (F). Because of the following two reasons, we only need 7 corresponding points.

    Reason 1

    We lose 1 DOF because we are using homogeneous coordinates. This basically is a way to represent nD points as a vector form by adding an extra dimension. ie) A 2D point (0,2) can be represented as [0,2,1], in general [x,y,1]. There are useful properties when using homogeneous coordinates with 2D/3D transformation, but I'm going to assume you know that.

    Now given the expression p and p' representing pixel coordinates:

    p'=[u',v',1] and p=[u,v,1]
    

    the fundamental matrix:

    F = [f1,f2,f3]
        [f4,f5,f6]
        [f7,f8,f9]
    

    and fundamental matrix equation:

    (transposed p')Fp = 0
    

    when we multiply this expression in algebra form, we get the following:

    uu'f1 + vu'f2 + u'f3 + uv'f4 + vv'f5 + v'f6 + uf7 + vf8 + f9 = 0. 
    

    In a homogeneous system of linear equation form Af=0 (basically the factorization of the above formula), we get two components A and f.

    A:

    [uu',vu',u', uv',vv',v',u,v,1] 
    

    f (f is essentially the fundamental matrix in vector form):

    [f1,f2'f3,f4,f5,f6,f7,f8,f9]
    

    Now if we look at the components of vector A, we have 8 unknowns, but value of one of terms is already known (1 in this case) because of homogeneous coordinates. Thus we need only 8 equations now.

    Reason 2

    det F = 0.
    

    A determinant is a value that can be obtained from a square matrix.

    I'm not entirely sure about the mathematical details of this property but I can still infer the basic idea, and, hopefully, you can as well.

    Basically given some matrix A

    A = [a,b,c]
        [d,e,f]
        [g,h,i]
    

    The determinant can be computed using this formula:

    det A = aei+bfg+cdh-ceg-bdi-afh
    

    If we look at the determinant using the fundamental matrix, the algebra would look something like this:

    F = [f1,f2,f3]
        [f4,f5,f6]
        [f7,f8,f9]
    
    det F = (f1*f5*f8)+(f2*f6*f7)+(f3*f4*f8)-(f3*f5*f7)-(f2*f4*f9)-(f1*f6*f8)
    

    Now we know the determinant of the fundamental matrix is zero:

    det F = (f1*f5*f8)+(f2*f6*f7)+(f3*f4*f8)-(f3*f5*f7)-(f2*f4*f9)-(f1*f6*f8) = 0
    

    So, if we work out only 7 of the 9 parameters of the fundamental matrix, we can work out the last parameter using the above determinant equation.

    Therefore the fundamental matrix has 7DOF.