View Source Evision.Rapid (Evision v0.1.28)

Link to this section Summary

Types

t()

Type that represents an Rapid struct.

Link to this section Types

@type t() :: %Evision.Rapid{ref: reference()}

Type that represents an Rapid struct.

  • ref. reference()

    The underlying erlang resource variable.

Link to this section Functions

Link to this function

convertCorrespondencies(cols, srcLocations)

View Source
@spec convertCorrespondencies(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) ::
  {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}

convertCorrespondencies

Positional Arguments
  • cols: Evision.Mat.t().

    correspondence-position per line in line-bundle-space

  • srcLocations: Evision.Mat.t().

    the source image location

Keyword Arguments
  • mask: Evision.Mat.t().

    mask containing non-zero values for the elements to be retained

Return
  • pts2d: Evision.Mat.t().

    2d points

  • pts3d: Evision.Mat.t().

    3d points

Collect corresponding 2d and 3d points based on correspondencies and mask

Python prototype (for reference only):

convertCorrespondencies(cols, srcLocations[, pts2d[, pts3d[, mask]]]) -> pts2d, pts3d
Link to this function

convertCorrespondencies(cols, srcLocations, opts)

View Source
@spec convertCorrespondencies(
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  [{atom(), term()}, ...] | nil
) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}

convertCorrespondencies

Positional Arguments
  • cols: Evision.Mat.t().

    correspondence-position per line in line-bundle-space

  • srcLocations: Evision.Mat.t().

    the source image location

Keyword Arguments
  • mask: Evision.Mat.t().

    mask containing non-zero values for the elements to be retained

Return
  • pts2d: Evision.Mat.t().

    2d points

  • pts3d: Evision.Mat.t().

    3d points

Collect corresponding 2d and 3d points based on correspondencies and mask

Python prototype (for reference only):

convertCorrespondencies(cols, srcLocations[, pts2d[, pts3d[, mask]]]) -> pts2d, pts3d
Link to this function

drawCorrespondencies(bundle, cols)

View Source
@spec drawCorrespondencies(Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) ::
  Evision.Mat.t() | {:error, String.t()}

drawCorrespondencies

Positional Arguments
  • cols: Evision.Mat.t().

    column coordinates in the line bundle

Keyword Arguments
  • colors: Evision.Mat.t().

    colors for the markers. Defaults to white.

Return
  • bundle: Evision.Mat.t().

    the lineBundle

Debug draw markers of matched correspondences onto a lineBundle

Python prototype (for reference only):

drawCorrespondencies(bundle, cols[, colors]) -> bundle
Link to this function

drawCorrespondencies(bundle, cols, opts)

View Source
@spec drawCorrespondencies(
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  [{atom(), term()}, ...] | nil
) :: Evision.Mat.t() | {:error, String.t()}

drawCorrespondencies

Positional Arguments
  • cols: Evision.Mat.t().

    column coordinates in the line bundle

Keyword Arguments
  • colors: Evision.Mat.t().

    colors for the markers. Defaults to white.

Return
  • bundle: Evision.Mat.t().

    the lineBundle

Debug draw markers of matched correspondences onto a lineBundle

Python prototype (for reference only):

drawCorrespondencies(bundle, cols[, colors]) -> bundle
Link to this function

drawSearchLines(img, locations, color)

View Source
@spec drawSearchLines(
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  {number()}
  | {number(), number()}
  | {number() | number() | number()}
  | {number(), number(), number(), number()}
) :: Evision.Mat.t() | {:error, String.t()}

drawSearchLines

Positional Arguments
  • locations: Evision.Mat.t().

    the source locations of a line bundle

  • color: Scalar.

    the line color

Return
  • img: Evision.Mat.t().

    the output image

Debug draw search lines onto an image

Python prototype (for reference only):

drawSearchLines(img, locations, color) -> img
Link to this function

drawWireframe(img, pts2d, tris, color)

View Source
@spec drawWireframe(
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  {number()}
  | {number(), number()}
  | {number() | number() | number()}
  | {number(), number(), number(), number()}
) :: Evision.Mat.t() | {:error, String.t()}

drawWireframe

Positional Arguments
  • pts2d: Evision.Mat.t().

    the 2d points obtained by @ref projectPoints

  • tris: Evision.Mat.t().

    triangle face connectivity

  • color: Scalar.

    line color

Keyword Arguments
  • type: int.

    line type. See @ref LineTypes.

  • cullBackface: bool.

    enable back-face culling based on CCW order

Return
  • img: Evision.Mat.t().

    the output image

Draw a wireframe of a triangle mesh

Python prototype (for reference only):

drawWireframe(img, pts2d, tris, color[, type[, cullBackface]]) -> img
Link to this function

drawWireframe(img, pts2d, tris, color, opts)

View Source
@spec drawWireframe(
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  {number()}
  | {number(), number()}
  | {number() | number() | number()}
  | {number(), number(), number(), number()},
  [{atom(), term()}, ...] | nil
) :: Evision.Mat.t() | {:error, String.t()}

drawWireframe

Positional Arguments
  • pts2d: Evision.Mat.t().

    the 2d points obtained by @ref projectPoints

  • tris: Evision.Mat.t().

    triangle face connectivity

  • color: Scalar.

    line color

Keyword Arguments
  • type: int.

    line type. See @ref LineTypes.

  • cullBackface: bool.

    enable back-face culling based on CCW order

Return
  • img: Evision.Mat.t().

    the output image

Draw a wireframe of a triangle mesh

Python prototype (for reference only):

drawWireframe(img, pts2d, tris, color[, type[, cullBackface]]) -> img
Link to this function

extractControlPoints(num, len, pts3d, rvec, tvec, k, imsize, tris)

View Source

extractControlPoints

Positional Arguments
  • num: int.

    number of control points

  • len: int.

    search radius (used to restrict the ROI)

  • pts3d: Evision.Mat.t().

    the 3D points of the mesh

  • rvec: Evision.Mat.t().

    rotation between mesh and camera

  • tvec: Evision.Mat.t().

    translation between mesh and camera

  • k: Evision.Mat.t().

    camera intrinsic

  • imsize: Size.

    size of the video frame

  • tris: Evision.Mat.t().

    triangle face connectivity

Return
  • ctl2d: Evision.Mat.t().

    the 2D locations of the control points

  • ctl3d: Evision.Mat.t().

    matching 3D points of the mesh

Extract control points from the projected silhouette of a mesh see @cite drummond2002real Sec 2.1, Step b

Python prototype (for reference only):

extractControlPoints(num, len, pts3d, rvec, tvec, K, imsize, tris[, ctl2d[, ctl3d]]) -> ctl2d, ctl3d
Link to this function

extractControlPoints(num, len, pts3d, rvec, tvec, k, imsize, tris, opts)

View Source

extractControlPoints

Positional Arguments
  • num: int.

    number of control points

  • len: int.

    search radius (used to restrict the ROI)

  • pts3d: Evision.Mat.t().

    the 3D points of the mesh

  • rvec: Evision.Mat.t().

    rotation between mesh and camera

  • tvec: Evision.Mat.t().

    translation between mesh and camera

  • k: Evision.Mat.t().

    camera intrinsic

  • imsize: Size.

    size of the video frame

  • tris: Evision.Mat.t().

    triangle face connectivity

Return
  • ctl2d: Evision.Mat.t().

    the 2D locations of the control points

  • ctl3d: Evision.Mat.t().

    matching 3D points of the mesh

Extract control points from the projected silhouette of a mesh see @cite drummond2002real Sec 2.1, Step b

Python prototype (for reference only):

extractControlPoints(num, len, pts3d, rvec, tvec, K, imsize, tris[, ctl2d[, ctl3d]]) -> ctl2d, ctl3d
Link to this function

extractLineBundle(len, ctl2d, img)

View Source
@spec extractLineBundle(
  integer(),
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in()
) ::
  {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}

extractLineBundle

Positional Arguments
  • len: int.

    the search radius. The bundle will have 2*len + 1 columns.

  • ctl2d: Evision.Mat.t().

    the search lines will be centered at this points and orthogonal to the contour defined by them. The bundle will have as many rows.

  • img: Evision.Mat.t().

    the image to read the pixel intensities values from

Return
  • bundle: Evision.Mat.t().

    line bundle image with size ctl2d.rows() x (2 * len + 1) and the same type as @p img

  • srcLocations: Evision.Mat.t().

    the source pixel locations of @p bundle in @p img as CV_16SC2

Extract the line bundle from an image

Python prototype (for reference only):

extractLineBundle(len, ctl2d, img[, bundle[, srcLocations]]) -> bundle, srcLocations
Link to this function

extractLineBundle(len, ctl2d, img, opts)

View Source
@spec extractLineBundle(
  integer(),
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  [{atom(), term()}, ...] | nil
) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}

extractLineBundle

Positional Arguments
  • len: int.

    the search radius. The bundle will have 2*len + 1 columns.

  • ctl2d: Evision.Mat.t().

    the search lines will be centered at this points and orthogonal to the contour defined by them. The bundle will have as many rows.

  • img: Evision.Mat.t().

    the image to read the pixel intensities values from

Return
  • bundle: Evision.Mat.t().

    line bundle image with size ctl2d.rows() x (2 * len + 1) and the same type as @p img

  • srcLocations: Evision.Mat.t().

    the source pixel locations of @p bundle in @p img as CV_16SC2

Extract the line bundle from an image

Python prototype (for reference only):

extractLineBundle(len, ctl2d, img[, bundle[, srcLocations]]) -> bundle, srcLocations
Link to this function

findCorrespondencies(bundle)

View Source
@spec findCorrespondencies(Evision.Mat.maybe_mat_in()) ::
  {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}

findCorrespondencies

Positional Arguments
  • bundle: Evision.Mat.t().

    the line bundle

Return
  • cols: Evision.Mat.t().

    correspondence-position per line in line-bundle-space

  • response: Evision.Mat.t().

    the sobel response for the selected point

Find corresponding image locations by searching for a maximal sobel edge along the search line (a single row in the bundle)

Python prototype (for reference only):

findCorrespondencies(bundle[, cols[, response]]) -> cols, response
Link to this function

findCorrespondencies(bundle, opts)

View Source
@spec findCorrespondencies(Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil) ::
  {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}

findCorrespondencies

Positional Arguments
  • bundle: Evision.Mat.t().

    the line bundle

Return
  • cols: Evision.Mat.t().

    correspondence-position per line in line-bundle-space

  • response: Evision.Mat.t().

    the sobel response for the selected point

Find corresponding image locations by searching for a maximal sobel edge along the search line (a single row in the bundle)

Python prototype (for reference only):

findCorrespondencies(bundle[, cols[, response]]) -> cols, response
Link to this function

rapid(img, num, len, pts3d, tris, k, rvec, tvec)

View Source

rapid

Positional Arguments
  • img: Evision.Mat.t().

    the video frame

  • num: int.

    number of search lines

  • len: int.

    search line radius

  • pts3d: Evision.Mat.t().

    the 3D points of the mesh

  • tris: Evision.Mat.t().

    triangle face connectivity

  • k: Evision.Mat.t().

    camera matrix

Return
  • retval: float

  • rvec: Evision.Mat.t().

    rotation between mesh and camera. Input values are used as an initial solution.

  • tvec: Evision.Mat.t().

    translation between mesh and camera. Input values are used as an initial solution.

  • rmsd: double*.

    the 2d reprojection difference

High level function to execute a single rapid @cite harris1990rapid iteration

  1. @ref extractControlPoints
  2. @ref extractLineBundle
  3. @ref findCorrespondencies
  4. @ref convertCorrespondencies
  5. @ref solvePnPRefineLM @return ratio of search lines that could be extracted and matched

Python prototype (for reference only):

rapid(img, num, len, pts3d, tris, K, rvec, tvec) -> retval, rvec, tvec, rmsd