View Source Evision.Rapid (Evision v0.2.9)

Summary

Types

t()

Type that represents an Rapid struct.

Types

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

Type that represents an Rapid struct.

  • ref. reference()

    The underlying erlang resource variable.

Functions

Link to this function

convertCorrespondencies(named_args)

View Source
@spec convertCorrespondencies(Keyword.t()) :: any() | {:error, String.t()}
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.

    correspondence-position per line in line-bundle-space

  • srcLocations: Evision.Mat.

    the source image location

Keyword Arguments
  • mask: Evision.Mat.

    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(),
  [{:mask, term()}] | nil
) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}

convertCorrespondencies

Positional Arguments
  • cols: Evision.Mat.

    correspondence-position per line in line-bundle-space

  • srcLocations: Evision.Mat.

    the source image location

Keyword Arguments
  • mask: Evision.Mat.

    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(named_args)

View Source
@spec drawCorrespondencies(Keyword.t()) :: any() | {:error, String.t()}
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.

    column coordinates in the line bundle

Keyword Arguments
  • colors: Evision.Mat.

    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(),
  [{:colors, term()}] | nil
) :: Evision.Mat.t() | {:error, String.t()}

drawCorrespondencies

Positional Arguments
  • cols: Evision.Mat.

    column coordinates in the line bundle

Keyword Arguments
  • colors: Evision.Mat.

    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(named_args)

View Source
@spec drawSearchLines(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

drawSearchLines(img, locations, color)

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

drawSearchLines

Positional Arguments
  • locations: Evision.Mat.

    the source locations of a line bundle

  • color: Evision.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(named_args)

View Source
@spec drawWireframe(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

drawWireframe(img, pts2d, tris, color)

View Source

drawWireframe

Positional Arguments
  • pts2d: Evision.Mat.

    the 2d points obtained by @ref projectPoints

  • tris: Evision.Mat.

    triangle face connectivity

  • color: Evision.scalar().

    line color

Keyword Arguments
  • type: integer().

    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(),
  Evision.scalar(),
  [cullBackface: term(), type: term()] | nil
) :: Evision.Mat.t() | {:error, String.t()}

drawWireframe

Positional Arguments
  • pts2d: Evision.Mat.

    the 2d points obtained by @ref projectPoints

  • tris: Evision.Mat.

    triangle face connectivity

  • color: Evision.scalar().

    line color

Keyword Arguments
  • type: integer().

    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(named_args)

View Source
@spec extractControlPoints(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

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

View Source

extractControlPoints

Positional Arguments
  • num: integer().

    number of control points

  • len: integer().

    search radius (used to restrict the ROI)

  • pts3d: Evision.Mat.

    the 3D points of the mesh

  • rvec: Evision.Mat.

    rotation between mesh and camera

  • tvec: Evision.Mat.

    translation between mesh and camera

  • k: Evision.Mat.

    camera intrinsic

  • imsize: Size.

    size of the video frame

  • tris: Evision.Mat.

    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: integer().

    number of control points

  • len: integer().

    search radius (used to restrict the ROI)

  • pts3d: Evision.Mat.

    the 3D points of the mesh

  • rvec: Evision.Mat.

    rotation between mesh and camera

  • tvec: Evision.Mat.

    translation between mesh and camera

  • k: Evision.Mat.

    camera intrinsic

  • imsize: Size.

    size of the video frame

  • tris: Evision.Mat.

    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(named_args)

View Source
@spec extractLineBundle(Keyword.t()) :: any() | {:error, String.t()}
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: integer().

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

  • ctl2d: Evision.Mat.

    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.

    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: integer().

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

  • ctl2d: Evision.Mat.

    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.

    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(named_args)

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

findCorrespondencies

Positional Arguments
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
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
@spec rapid(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

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

View Source

rapid

Positional Arguments
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