關於矩陣自由度的解釋

在計算機視覺應用中,常常遇見矩陣自由度的說法,矩陣自由度同矩陣自己的性質,以及相關線性方程組的解,有着千絲萬縷的聯繫,這裏就集中解釋下DOF(degree of freedom)的具體含義。dom

1.矩陣的自由度的定義ide

There are several different ways to think about degrees of freedom of a matrix.post

Consider a m×n matrix. This matrix has mn entries. We can change mn values in this matrix to make mn unique matrices, so it has mn degrees of freedom.ui

What if we had a square m×m matrix that we knew was upper triangular? Well then, we know that several values in the matrix are 0. There are actually only m+m−1+⋯+2+1 nonzero entries, and so that's the number of the degrees of freedom of the matrix.this

What is we had a 2×2 matrix that we knew was a rotation matrix? That puts huge constraints on the possible values in the matrix. Indeed, once one of the values is chosen, then all other values have been decided. There is only one degree of freedom in this matrix. This is easy to see geometrically; a rotation matrix on R2 can only rotate by an angle, which is its degree of freedom.idea

What if we had "equivalence classes"? What if we knew that all scalings of any matrix were equivalent. How many degrees of freedom do we have left? For any matrix, when the (1,1) element is non-zero, we can divide all elements of the matrix by the first element to make it 1. So if we had two matrices A and B=2A, when we scaled these matrices so that their first elements were 1, we'd see that they were equivalent. And thus, we've eliminated a degree of freedom. This is the case with homographies. So, for a 3×3 homography matrix, there are only 8 degrees of freedom. These degrees of freedom can also be interpreted geometrically.spa

選自:https://math.stackexchange.com/questions/2771591/degrees-of-freedom-for-a-matrixci

簡而言之,矩陣的自由度反映了矩陣中每一個元素互相約束的狀態。element

關於homography矩陣,多說兩句。它是up to a scale的,就是說 kH ~ H,通常在實現的時候(OpenCV),爲了保證這個約束,通常採用兩種方式。rem

以3*3矩陣爲例,一種是H33 = 1,或者是 H11*H11 + H12*H12 + H13*H13 + H21*H21 + H22*H22 + H23*H23 + H31*H31 + H32*H32 + H33*H33 = 1

 

又如:以3*3的Rotation Matrix爲例,爲何其自由度爲3?

In nn dimensions you have 1/2n(n−1) degrees of freedom.

One argument goes like these lines: In nn dimensions a rotation matrix R has n^2 degrees of freedom. Rotations preserve the dot products of vectors. So utv=utRtRv for any vectors u and v and so RtR=I.

That's n^2 equations. But those below the diagonal are the same as those above. So we only have 1/2n(n+1) equations leaving 1/2n(n−1) degrees of freedom.

There's actually one more constraint: rotations need to preserve volume so detR=1.

You can already deduce (detR)2=1 from RtR=I so this extra constraint doesn't reduce the degrees of freedom, it just cuts the space in half. A full proof requires showing that the remaining equations are algebraically independent.

 

2.方程自由度的定義

與矩陣自由度相似的,還有方程自由度的定義。

The degrees of freedom is used when you have more variables than equations and the degrees of freedom is how many more variables you have than equations. So if you have 10 variables and 7 equations you have 3 degrees of freedom. I.e. 3 of the variables can assume whatever value you want and for any given choice of values for these 3 variables the remaining 7 have a specific value for a solution.

I.e. the number of equations + the degree of freedom always gives you how many variables you have.

If the number of equations are more than the number of variables you don't have any freedom and the system of equations are typically not solvable at all.

If you do have degrees of freedom, you typically need to find some additional constraint that can add additional equations. The idea is to have exactly the same number of equations as variables in which case there is one and only one solution. This is under the assumption that the equations are linearly independent. You must first remove all linearly dependent equations before you count the degrees of freedom.

For example: 2x + 3y = 5 and 4x + 6y = 10 are two equations but they are not linearly independent so when you remove one you see that you have only one equation with two variables so you have one equation and one degree of freedom.

 

3. 舉例

以張正友的標定爲例,在其論文A Flexible New Technique for Camera Calibration中,第2.3節有這麼一段話:

These are the two basic constraints on the intrinsic parameters, given one homography. Because a
homography has 8 degrees of freedom and there are 6 extrinsic parameters (3 for rotation and 3 for
translation), we can only obtain 2 constraints on the intrinsic parameters.

能夠這麼理解:H矩陣有8個自由度,構成它的矩陣有一個R矩陣,有三個自由度,一個T矩陣有三個自由度,那就還剩下A矩陣的兩個自由度。但由於A矩陣有四個元素(這裏設skew爲0),因此必須有兩個約束保證其自有度只有兩個(4-2=2)

相關文章
相關標籤/搜索