I am trying to decompose a Sobel filter into two vectors (column and a row) using Matlab.
If our Sobel filter is
A = [1 0 -1; 2 0 -2; 1 0 -1]
we can get the U, S, V matrices in Matlab with
[U, S, V] = svd(A)
Which returns
U =
-0.4082 0.9129 -0.0000
-0.8165 -0.3651 -0.4472
-0.4082 -0.1826 0.8944
S =
3.4641 0 0
0 0.0000 0
0 0 0
V =
-0.7071 -0.7071 0
0 0 -1.0000
0.7071 -0.7071 0
Now, according to How to Decompose a Separable Filter?, our row and column vectors should be
sqrt(3.4641)*u1
and sqrt(3.464)*v1.'
but these operations do not return the answer, which should be
[1; 2; 1]
and [1 0 -1]