SVD computing different result in Matlab and OpenCV

点点圈 提交于 2019-11-29 01:35:05

Which version of OpenCV are you using?

From http://code.opencv.org/issues/1498 it seems recent versions of OpenCV no longer use LAPACK to do SVD (as used by Matlab, I think). So the assumption that the same algorithm is being used might not be correct.

Of course YY=USV'

If you negate the first columns of U and V:

U(:,1)=-U(:,1);
V(:,1)=-V(:,1)

You will find USV' still equals YY. This works for your particular case because YY is symmetric (YY=YY').

The results of the SVD need not be unique. For example, I = UIV' for any unitary V = U. The example you give above in particular is rank deficient, so there is no reason to expect uniqueness.

Singular Value Decomposition is only defined up to a sign; the signs of U and V are arbitrary, and if they are different between MATLAB and OpenCV that does not indicate a problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!