findHomography: Perspective Transformation Between Two Planes

View source: R/transform.R

findHomographyR Documentation

Perspective Transformation Between Two Planes

Description

findHomography computes a perspective transformation between two planes.

Usage

findHomography(
  from,
  to,
  from_dim,
  to_dim = from_dim,
  method = "RANSAC",
  ransac_reproj_th = 3,
  max_it = 2000,
  conf = 0.95
)

Arguments

from

A Nx2 matrix indicating the location (x, y) of N points in the source image.

to

A Nx2 matrix indicating the location (x, y) of N points in the destination image. The order of the points must correspond to the order in from.

from_dim

A vector which first two elements indicate the number of rows and columns of the source image.

to_dim

A vector which first two elements indicate the number of rows and columns of the destination image. If not specified, from_dim will be used as a default.

method

A character string indicating the method used to compute a homography matrix. It can be one of the followings: "LS" (least-square), "RANSAC" (RANSAC-based robust method; the default), "LMEDS" (Least-Median robust method), or "RHO" (PROSAC-based robust method).

ransac_reproj_th

Maximum allowed reprojection error to treat a point pair as an inlier (used in the RANSAC and RHO methods only). If 'from' and 'to' are measured in pixels, it usually makes sense to set this parameter somewhere in the range of 1 to 10.

max_it

The maximum number of RANSAC iterations.

conf

Confidence level, between 0 and 1.

Value

A 3x3 homography matrix.

Author(s)

Simon Garnier, garnier@njit.edu

See Also

getPerspectiveTransform, getAffineTransform, warpPerspective

Examples

src <- cbind(x = c(0, 1, 1, 0), y = c(0, 0, 1, 1))
dst <- src + 1
findHomography(src, dst, c(10, 10))


swarm-lab/Rvision documentation built on Feb. 7, 2024, 4:59 a.m.