# Parameters of cv::SVDecomp

Hi,

what are the parameters w, u, vt of `cv::SVDecomp(src, w, u, vt)`

in comparison to Matlab's

```
[U,S,V] = svd(src);
```

I need the submatrices for further calculations that I already have given in Matlab. Can I directly translate w to U, u to S and vt to V. It seems like they are having varying Matrix sizes. I did not find further explanations on the SVDecomp function (e.g. here: documentation)

Edit:

I tried more stuff. I have the src matrix of size 27x18 (edited):
In Matlab I get as result for the sizes U(27x27), S(27x18), V(18x18) which solves the SVD equation src=U*S*V'

In OpenCV I open the same matrix src(27x18) and I get as result with `cv::SVD::FULL_UV`

:

w(1x18), u(18x18), vt(27x27) which does **not** solve the equation. I am quite confused right now, what is going on in openCV SVD.

hmm, i cannot reproduce your numbers (opencv version ?)

(and

`W`

is only the trace, the diagonal of a 27x27 Matrix)hey, even for the edited version i get

`[1 x 18][27 x 27][18 x 18]`

(imho, you messed up U and VT, please don't be that sloppy !)Sry, had an error in the description. My source matrix is 27x18. Ok, you are even faster than me :D. Wait, I will try in a minimal example and report. I cannot see an error in my std::cout right now -.-

formula in the answer below will work, if you use:

Ok, I am dumb. I assumed my matrix is 27 x 18 because I got it from src.size(). In fact the matrix is 18 x 27 which I could get from src.size().height and src.size().width. So no error in the SVD, but I got confused really hard with the size function.

`cv::Mat E_new(27, 18, CV_64F); std::cout << E_new.size() << " " << E_new.size().height << " and " << E_new.size().width << std::endl;`

the WxH, rowsXcols thing ... it

isconfusing..