转自:https://blog.csdn.net/dellme99/article/details/50033295
getPerspectiveTransform()和findHomography()
都用于计算单应性矩阵,即解一个线性方程组。由于单应矩阵有8个未知数(3*3,其中第9个数为1),所以至少需要4个点(每个点-x,y,提供2个约束方程)。
getPerspectiveTransform用的是SVD分解,getPerspectiveTransform只会拿前4个点去计算,getPerspectiveTransform()比较简单粗暴。
findHomography则会拿一堆点(>=4)去计算(其是不断从一堆点中重复拿出4个点去计算出一个结果,再采用一些优化算法RANSAC/LMEDS去筛选出最优解)。
焦距计算(K矩阵)
K矩阵有[焦距, ppx(图片的宽),ppy(图片的高),aspect(宽高比)]等计算出来的。 这里焦距需要计算。
焦距计算从单应性矩阵里面计算出来,一个H矩阵计算出两个焦距。单应性矩阵由配对的内点计算出来。
HomographyBasedEstimator::estimate() =>
estimateFocal(features, pairwise_matches,focals);
R矩阵计算
根据匹配的内点对两个K矩阵和内点对的H矩阵计算出R矩阵
findHomography()与 HomographyBasedEstimator()
来自stackoverflow的答案:
he main difference between both functions is that findHomography, as the name says, is used to find an homography, and HomographyBasesEstimator uses an already existing homographies to calculate the rotation of the cameras.
I mean, HomographyBasesEstimator doesn’t find the homographies, it use them to do the**computation of camera motion and all the other camera parameters **such as focal lengths and optical centers.