/// <summary>
/// Use the specific method to find perspective transformation H=||h_ij|| between the source and the destination planes
/// </summary>
/// <param name="srcPoints">Point coordinates in the original plane, 2xN, Nx2, 3xN or Nx3 array (the latter two are for representation in homogeneous coordinates), where N is the number of points</param>
/// <param name="dstPoints">Point coordinates in the destination plane, 2xN, Nx2, 3xN or Nx3 array (the latter two are for representation in homogeneous coordinates) </param>
/// <param name="method">FindHomography method</param>
/// <param name="ransacReprojThreshold">The maximum allowed reprojection error to treat a point pair as an inlier. The parameter is only used in RANSAC-based homography estimation. E.g. if dst_points coordinates are measured in pixels with pixel-accurate precision, it makes sense to set this parameter somewhere in the range ~1..3</param>
/// <returns>The 3x3 homography matrix if found. Null if not found.</returns>
public static HomographyMatrix FindHomography(
Matrix <float> srcPoints,
Matrix <float> dstPoints,
CvEnum.HOMOGRAPHY_METHOD method,
double ransacReprojThreshold)
{
HomographyMatrix homography = new HomographyMatrix();
if (!CvInvoke.cvFindHomography(srcPoints.Ptr, dstPoints.Ptr, homography.Ptr, method, ransacReprojThreshold, IntPtr.Zero))
{
homography.Dispose();
return(null);
}
return(homography);
}