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?
问问题
4339 次
2 回答
5
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.
于 2013-05-08T12:01:22.973 回答
2
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.
于 2017-04-05T10:21:55.687 回答