I want to verify that homography matrix will give good results and this this answer
has an answer for it - but, I don't know how to implement the answer.
So can anyone recommend how I may use OpenCV to compute SVD and and verify that the ratio of the first-to-last singular value is sane?
Asked
Active
Viewed 5,352 times
4
-
Hello Tony, I have the same question you are doing. And I can see how to compute SVD, but I still don't understand the part of "verify that the ratio of the first-to-last singular value is sane". Could you solve this?. Thank you – Angie Quijano Mar 02 '16 at 22:44
-
1There were no exact solution for this. I made a lot of tests for my specific problem and decided a threshold value myself. – Tony Mar 03 '16 at 14:12
2 Answers
6
There are several ways to compute the SVD in OpenCV:
cv::SVD homographySVD(homography, cv::SVD::FULL_UV); // constructor
// or:
homographySVD(newHomography, cv::SVD::FULL_UV); // operator ()
homographySVD.w.at<double>(0, 0); // access the first singular value
// alternatives:
cv::SVD::compute(homography, w); // compute just the singular values
cv::eigen(homography, w);
Have a look at the documentation for cv::SVD and cv::eigen for more details.

bjoernz
- 3,852
- 18
- 30
3
You can compute SVD in python using numpy
.
For example:
import numpy as np
U, s, V = np.linalg.svd(a, full_matrices=True)
which factors the matrix a
of dimension M x N
as u * np.diag(s) * v
, where u
and v
are unitary and s
is a 1-d array of a
's singular values.
More can be found here.

gaya
- 463
- 2
- 6
- 22