| OpenCV 4.3.0 Open Source Computer Vision

Functions
silhouette based 3D object tracking

## Functions
void | cv::rapid::drawCorrespondencies (InputOutputArray bundle, InputArray srcLocations, InputArray newLocations, InputArray colors=noArray())
void | cv::rapid::drawSearchLines (InputOutputArray img, InputArray locations, const Scalar &color)
void | cv::rapid::drawWireframe (InputOutputArray img, InputArray pts2d, InputArray tris, const Scalar &color, int type=LINE_8, bool cullBackface=false)
void | cv::rapid::extractControlPoints (int num, int len, InputArray pts3d, InputArray rvec, InputArray tvec, InputArray K, const Size &imsize, InputArray tris, OutputArray ctl2d, OutputArray ctl3d)
void | cv::rapid::extractLineBundle (int len, InputArray ctl2d, InputArray img, OutputArray bundle, OutputArray srcLocations)
void | cv::rapid::filterCorrespondencies (InputOutputArray pts2d, InputOutputArray pts3d, InputArray mask)
void | cv::rapid::findCorrespondencies (InputArray bundle, InputArray srcLocations, OutputArray newLocations, OutputArray response=noArray())
float | cv::rapid::rapid (InputArray img, int num, int len, InputArray pts3d, InputArray tris, InputArray K, InputOutputArray rvec, InputOutputArray tvec)

## Detailed Description

implements "RAPID-a video rate object tracker" [95] with the dynamic control point extraction of [55]

## Function Documentation

## ◆ drawCorrespondencies()

void cv::rapid::drawCorrespondencies | ( | InputOutputArray | bundle,
|  | InputArray | srcLocations,
|  | InputArray | newLocations,
|  | InputArray | colors = `noArray()`
| ) |  |

Python:
| bundle | = | cv.rapid.drawCorrespondencies( | bundle, srcLocations, newLocations[, colors] | )

`#include <opencv2/rapid.hpp>`

Debug draw markers of matched correspondences onto a lineBundle

Parameters

  bundle | the lineBundle
  srcLocations | the according source locations
  newLocations | matched source locations
  colors | colors for the markers. Defaults to white.

## ◆ drawSearchLines()

void cv::rapid::drawSearchLines | ( | InputOutputArray | img,
|  | InputArray | locations,
|  | const Scalar & | color
| ) |  |

Python:
| img | = | cv.rapid.drawSearchLines( | img, locations, color | )

`#include <opencv2/rapid.hpp>`

Debug draw search lines onto an image

Parameters

  img | the output image
  locations | the source locations of a line bundle
  color | the line color

## ◆ drawWireframe()

void cv::rapid::drawWireframe | ( | InputOutputArray | img,
|  | InputArray | pts2d,
|  | InputArray | tris,
|  | const Scalar & | color,
|  | int | type = `LINE_8`,
|  | bool | cullBackface = `false`
| ) |  |

Python:
| img | = | cv.rapid.drawWireframe( | img, pts2d, tris, color[, type[, cullBackface]] | )

`#include <opencv2/rapid.hpp>`

Draw a wireframe of a triangle mesh

Parameters

  img | the output image
  pts2d | the 2d points obtained by projectPoints
  tris | triangle face connectivity
  color | line color
  type | line type. See LineTypes.
  cullBackface | enable back-face culling based on CCW order

## ◆ extractControlPoints()

void cv::rapid::extractControlPoints | ( | int | num,
|  | int | len,
|  | InputArray | pts3d,
|  | InputArray | rvec,
|  | InputArray | tvec,
|  | InputArray | K,
|  | const Size & | imsize,
|  | InputArray | tris,
|  | OutputArray | ctl2d,
|  | OutputArray | ctl3d
| ) |  |

Python:
| ctl2d, ctl3d | = | cv.rapid.extractControlPoints( | num, len, pts3d, rvec, tvec, K, imsize, tris[, ctl2d[, ctl3d]] | )

`#include <opencv2/rapid.hpp>`

Extract control points from the projected silhouette of a mesh

see [55] Sec 2.1, Step b

Parameters

  num | number of control points
  len | search radius (used to restrict the ROI)
  pts3d | the 3D points of the mesh
  rvec | rotation between mesh and camera
  tvec | translation between mesh and camera
  K | camera intrinsic
  imsize | size of the video frame
  tris | triangle face connectivity
  ctl2d | the 2D locations of the control points
  ctl3d | matching 3D points of the mesh

## ◆ extractLineBundle()

void cv::rapid::extractLineBundle | ( | int | len,
|  | InputArray | ctl2d,
|  | InputArray | img,
|  | OutputArray | bundle,
|  | OutputArray | srcLocations
| ) |  |

Python:
| bundle, srcLocations | = | cv.rapid.extractLineBundle( | len, ctl2d, img[, bundle[, srcLocations]] | )

`#include <opencv2/rapid.hpp>`

Extract the line bundle from an image

Parameters

  len | the search radius. The bundle will have `2*len + 1` columns.
  ctl2d | 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 | the image to read the pixel intensities values from
  bundle | line bundle image with size `ctl2d.rows() x (2 * len + 1)` and the same type as `img`
  srcLocations | the source pixel locations of `bundle` in `img` as CV_16SC2

## ◆ filterCorrespondencies()

void cv::rapid::filterCorrespondencies | ( | InputOutputArray | pts2d,
|  | InputOutputArray | pts3d,
|  | InputArray | mask
| ) |  |

Python:
| pts2d, pts3d | = | cv.rapid.filterCorrespondencies( | pts2d, pts3d, mask | )

`#include <opencv2/rapid.hpp>`

Filter corresponding 2d and 3d points based on mask

Parameters

  pts2d | 2d points
  pts3d | 3d points
  mask | mask containing non-zero values for the elements to be retained

## ◆ findCorrespondencies()

void cv::rapid::findCorrespondencies | ( | InputArray | bundle,
|  | InputArray | srcLocations,
|  | OutputArray | newLocations,
|  | OutputArray | response = `noArray()`
| ) |  |

Python:
| newLocations, response | = | cv.rapid.findCorrespondencies( | bundle, srcLocations[, newLocations[, response]] | )

`#include <opencv2/rapid.hpp>`

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

Parameters

  bundle | the line bundle
  srcLocations | the according source image location
  newLocations | image locations with maximal edge along the search line
  response | the sobel response for the selected point

## ◆ rapid()

float cv::rapid::rapid | ( | InputArray | img,
|  | int | num,
|  | int | len,
|  | InputArray | pts3d,
|  | InputArray | tris,
|  | InputArray | K,
|  | InputOutputArray | rvec,
|  | InputOutputArray | tvec
| ) |  |

Python:
| retval, rvec, tvec | = | cv.rapid.rapid( | img, num, len, pts3d, tris, K, rvec, tvec | )

`#include <opencv2/rapid.hpp>`

High level function to execute a single rapid [95] iteration

1. extractControlPoints
2. extractLineBundle
3. findCorrespondencies
4. filterCorrespondencies
5. solvePnPRefineLM

Parameters

  img | the video frame
  num | number of search lines
  len | search line radius
  pts3d | the 3D points of the mesh
  tris | triangle face connectivity
  K | camera matrix
  rvec | rotation between mesh and camera. Input values are used as an initial solution.
  tvec | translation between mesh and camera. Input values are used as an initial solution.

Returns
  ratio of search lines that could be extracted and matched