仿射变换透射变换单应性矩阵

来源:互联网 发布:剑侠情缘网络3电视剧 编辑:程序博客网 时间:2024/05/16 18:14
  • estimateRigidTransform():计算多个二维点对或者图像之间的最优仿射变换矩阵 (2行x3列),H可以是部分自由度,比如各向一致的切变。
  • getAffineTransform():计算3个二维点对之间的仿射变换矩阵H(2行x3列),自由度为6.
  • warpAffine():对输入图像进行仿射变换
  • findHomography: 计算多个二维点对之间的最优单映射变换矩阵 H(3行x3列) ,使用最小均方误差或者RANSAC方法 。
  • getPerspectiveTransform():计算4个二维点对之间的透射变换矩阵 H(3行x3列)
  • warpPerspective(): 对输入图像进行透射变换
  • perspectiveTransform():对二维或者三维矢量进行透射变换,也就是对输入二维坐标点或者三维坐标点进行投射变换。
  • estimateAffine3D:计算多个三维点对之间的最优三维仿射变换矩阵H (3行x4列)
  • transform():对输入的N维矢量进行变换,可用于进行仿射变换、图像色彩变换.
  • findFundamentalMat:计算多个点对之间的基矩阵H。
快速解决:
  • 问题1:如何计算3个二维点对之间的仿射变换矩阵?
答:使用getAffineTransform()。
  • 问题2:如何计算多个二维点对之间的仿射变换矩阵(使用误差最小准则 )?
答:使用estimateRigidTransform()或者findHomography。
  • 问题3:如何计算4个二维点对之间的透射变换?
答:使用getPerspectiveTransform()。
  • 问题4:如何计算多个三维点对之间的仿射变换?
答:使用estimateAffine3D。
  • 问题5:如何对输入图像进行仿射变换?
答:使用warpAffine()。
  • 问题6:如何对输入图像进行透射变换?
答:使用perspectiveTransform()。
  • 问题7:如何对输入的二维点对进行仿射变换?
答:使用transform()。
  • 问题8:如何对输入的三维点对进行投射变换?
答:使用perspectiveTransform()。
findHomography 函数是求两幅图像的单应性矩阵,它是一个3*3的矩阵,但这里的单应性矩阵和3D重建中的单应性矩阵(透视矩阵3*4)是不一样的。之前一直混淆了两者的区别。
这里求两幅图像的单应性矩阵,只是利用多元方程组初步求解出H矩阵,然后利用迭代最小化反投影误差的方式进一步精确计算出H。H=(h11,h12,h13; h21,h22,h23; h31,h32,h33)
C++: Mat findHomography(InputArray srcPoints, InputArray dstPoints, int method=0, double ransacReprojThreshold=3, OutputArray mask=noArray() )?
Parameters:
  • srcPoints – Coordinates of the points in the original plane, a matrix of the type CV_32FC2 orvector<Point2f> .
  • dstPoints – Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or avector<Point2f> .
  • method –

    Method used to computed a homography matrix. The following methods are possible:

    • 0 - a regular method using all the points
    • CV_RANSAC - RANSAC-based robust method
    • CV_LMEDS - Least-Median robust method
  • ransacReprojThreshold –

    Maximum allowed reprojection error to treat a point pair as an inlier (used in the RANSAC method only). That is, if

    | texttt{dstPoints} _i -  texttt{convertPointsHomogeneous} ( texttt{H} * texttt{srcPoints} _i) |  >  texttt{ransacReprojThreshold}

    then the point i is considered an outlier. If srcPoints and dstPoints are measured in pixels, it usually makes sense to set this parameter somewhere in the range of 1 to 10.

  • mask – Optional output mask set by a robust method ( CV_RANSAC or CV_LMEDS ). Note that the input mask values are ignored.


代码移植,菜鸟请教:
1.此函数具体是怎样求解方程的呢?单应性矩阵有8个独立元素:H = h00 h01 h02      手动计算前两行元素与函数输出结
                                                                                                       h10 h11 h12
                                                                                                       h20 h21  1   
果接近,但h20和h21只能得到比例且比例与所选点坐标有关,感觉解不唯一,请问大神可以告知这两个元素是怎样确定的吗?
2.找不到cvFindHomography()源码,能告诉从哪里能获得吗?或者直接发给我就更好啦!谢!

最近学习有关findhomography的调用,请问经过RANSAC挑选适合的特征点后,
是用什么方法求出八个参数? (Levenberg-Marquardt? gradient descent? 还是其他方法)






1、src_points,dst_points为N×2或者N×3的矩阵,N×2表示点是以像素坐标表示。N×3表示以齐次坐标表示。

2、homography,为3*3大小的矩阵,用来存储输出的结果。



0 0
原创粉丝点击