View Source Evision.Rapid (Evision v0.2.9)
Summary
Functions
convertCorrespondencies
convertCorrespondencies
drawCorrespondencies
drawCorrespondencies
drawSearchLines
drawWireframe
drawWireframe
extractControlPoints
extractControlPoints
extractLineBundle
extractLineBundle
findCorrespondencies
findCorrespondencies
Types
@type t() :: %Evision.Rapid{ref: reference()}
Type that represents an Rapid
struct.
ref.
reference()
The underlying erlang resource variable.
Functions
@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
@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
@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
@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
@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
@spec drawWireframe( Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.scalar() ) :: 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
@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
extractControlPoints(num, len, pts3d, rvec, tvec, k, imsize, tris)
View Source@spec extractControlPoints( integer(), integer(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), {number(), number()}, Evision.Mat.maybe_mat_in() ) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
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
extractControlPoints(num, len, pts3d, rvec, tvec, k, imsize, tris, opts)
View Source@spec extractControlPoints( integer(), integer(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), {number(), number()}, Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil ) :: {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}
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
@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 imgsrcLocations:
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
@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 imgsrcLocations:
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
@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
bundle:
Evision.Mat
.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
@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
.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
@spec rapid( Evision.Mat.maybe_mat_in(), integer(), integer(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in() ) :: {number(), Evision.Mat.t(), Evision.Mat.t(), number()} | {:error, String.t()}
rapid
Positional Arguments
img:
Evision.Mat
.the video frame
num:
integer()
.number of search lines
len:
integer()
.search line radius
pts3d:
Evision.Mat
.the 3D points of the mesh
tris:
Evision.Mat
.triangle face connectivity
k:
Evision.Mat
.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
- @ref extractControlPoints
- @ref extractLineBundle
- @ref findCorrespondencies
- @ref convertCorrespondencies
- @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