opencv calculate matrix rank

前端 未结 1 1511
自闭症患者
自闭症患者 2021-01-22 04:35

I am trying to find rank of a matrix. In matlab this is fairly straight-forward but I am using visual studio 2008 (c++). I recently installed openCV and it works for most of m

1条回答
  •  梦毁少年i
    2021-01-22 04:53

    Read the following

    http://en.wikipedia.org/wiki/Singular_value_decomposition#Applications_of_the_SVD

    in the section Range, null space and rank it explains how to get the Rank from the singular values. Quoting this page:

    As a consequence, the rank of M equals the number of non-zero singular value

    So basically you can count the number of non-zero singular values and that is the rank. According to the link you provide in the question, your SVD calculation function in opencv should return you a matrix or vector of singular values - if it is a matrix, the singular values lie on the main diagonal of this matrix. From here you should be ok. There may be a simpler way, but I am not familiar with opencv.

    0 讨论(0)
提交回复
热议问题