Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

SVD with different solution as WolframAlpha

I've found out that the results of the SVDecomp function in Java are very different from the results of WolframAlpha.

The input matrix is excactly the same for OpenCV and WolframAlpha

{{0.2229632566816983, 18.15370964847313, 4.87085706173828},
{-14.31728552253419, 2.642676839378287, -33.69501515553716},
{-2.982323803144884, 33.70091859922499, 0.8997452211463326}}

Here are the results from WolframAlpha:

U = (-0.441818862735368 | 0.214800119324567 | -0.871009185525260
-0.245069575462508 | -0.962880608842737 | -0.113145200062862
-0.862981457340684 | 0.163468167704881 | 0.478059789601005)
W = (38.5925763913943 | 0 | 0
0 | 36.8337256561100 | 0
0 | 0 | 3.76859638821616×10^-10)
V = (0.155053443270976 | 0.362336795687042 | 0.919059560758203
-0.978207790691182 | 0.186347267503429 | 0.0915653543928191
0.138086740713550 | 0.913228745925823 | -0.383334461865688)

And here is what OpenCV produces when using SCDecomp:

 U: [0.4418188627353685, 0.2148001193245664, -0.8710091855252606;
0.2450695754625076, -0.9628806088427376, -0.113145200062862;
 0.8629814573406845, 0.1634681677048805, 0.4780597896010051]
 W: [38.59257639139431; 36.83372565611004; 3.768597946996713e-10]
 VT:[-0.155053443270976, 0.3623367956870423, 0.9190595607582029;
 0.9782077906911818, 0.1863472675034285, 0.09156535439281914;
-0.1380867407135498, 0.9132287459258235, -0.3833344618656882]

To mention: W in OpenCV is not a matrix, as well as the sign of the values are sometimes different.

Is this a bug? Here is my SourceCode

Core.SVDecomp(E, w, u, vt);