1 | initial version |
no idea if it solves your problem, but to reconstruct src
, it would be like:
Mat_<float> src(5,5), W,U,VT;
src << 1,2,3,4,5,
1,2,3,4,5,
1,2,3,4,5,
1,2,3,4,5,
1,2,3,4,5;
SVDecomp(src, W, U, VT, SVD::FULL_UV);
Mat_<float> WD(5,5);
W.copyTo(WD.diag());
Mat rec = VT.t() * WD * U.t();
cout << rec << endl;
[1.0000001, 1.0000001, 1.0000001, 1.0000001, 1.0000001;
2.0000002, 2.0000002, 2.0000002, 2.0000002, 2.0000002;
3, 3, 3, 3, 3;
4.0000005, 4.0000005, 4.0000005, 4.0000005, 4.0000005;
5.0000005, 5.0000005, 5.0000005, 5.0000005, 5.0000005]
(it returns the transposed src / result)