## VPI - Vision Programming Interface

#### 1.0 Release

Common Types

Defines common types used by several components. More...

## Data Structures

struct  VPIKeypoint
Stores a keypoint coordinate. More...

struct  VPIHomographyTransform2D
Stores a generic 2D homography transform. More...

struct  VPIBoundingBox
Stores a generic 2D bounding box. More...

## Macros

#define VPI_TERMINATION_CRITERIA_ITERATIONS   (1u << 0)
Defines the termination criteria macros. More...

## Enumerations

enum  VPIInterpolationType
Interpolation types supported by several algorithms. More...

enum  VPIBorderExtension
Image border extension specify how pixel values outside of the image domain should be constructed. More...

enum  VPILockMode
Defines the lock modes used by memory lock functions. More...

enum  VPIEventState
Defines the states of the event. More...

## Detailed Description

Defines common types used by several components.

## ◆ VPIKeypoint

 struct VPIKeypoint

Stores a keypoint coordinate.

The coordinate is relative to the top-left corner of an image.

Definition at line 254 of file Types.h.

Collaboration diagram for VPIKeypoint:
Data Fields
float x Keypoint's x coordinate.
float y Keypoint's y coordinate.

## ◆ VPIHomographyTransform2D

 struct VPIHomographyTransform2D

Stores a generic 2D homography transform.

When only scale and translation transformation is needed, these parameters must be arranged in the matrix as follows:

$\begin{bmatrix} s_x & 0 & p_x \\ 0 & s_y & p_y \\ 0 & 0 & 1 \end{bmatrix}$

Scaling $$(s_x,s_y)$$ is relative to the center of the patch, position $$(p_x,p_y)$$ is relative to the top-left of the image.

In the general case, given an homogeneous 2D point $$P(x,y,1)$$ and the matrix $$M^{3x3}$$, the Euclidean 2D point $$O(x,y)$$ is defined as

\begin{align} T &= M \cdot P \\ O &= (T_x/T_z, T_y/T_z) \end{align}

Definition at line 284 of file Types.h.

Collaboration diagram for VPIHomographyTransform2D:
Data Fields
float mat3[3][3] 3x3 homogeneous matrix that defines the homography.

## ◆ VPIBoundingBox

 struct VPIBoundingBox

Stores a generic 2D bounding box.

Although this structure can store a 2D bounding box transformed by any homography, most of the time it stores an axis-aligned bounding box. To retrieve it, do the following:

float x = xform.mat3[0][2];
float y = xform.mat3[1][2];
float w = width * xform.mat3[0][0];
float h = height * xform.mat3[1][1];
float width
Bounding box width.
Definition: Types.h:307
float height
Bounding box height.
Definition: Types.h:308
VPIHomographyTransform2D xform
Defines the bounding box top left corner and its homography.
Definition: Types.h:306
float mat3[3][3]
3x3 homogeneous matrix that defines the homography.
Definition: Types.h:286

Definition at line 304 of file Types.h.

Collaboration diagram for VPIBoundingBox:
Data Fields
float height Bounding box height.
float width Bounding box width.
VPIHomographyTransform2D xform Defines the bounding box top left corner and its homography.

## ◆ VPI_TERMINATION_CRITERIA_ITERATIONS

 #define VPI_TERMINATION_CRITERIA_ITERATIONS   (1u << 0)

#include <vpi/Types.h>

Defines the termination criteria macros.

Termination based on maximum number of iterations.

Definition at line 369 of file Types.h.

## ◆ VPIBorderExtension

 enum VPIBorderExtension

#include <vpi/Types.h>

Image border extension specify how pixel values outside of the image domain should be constructed.

Enumerator
VPI_BORDER_ZERO

All pixels outside the image are considered to be zero.

VPI_BORDER_CLAMP

Border pixels are repeated indefinitely.

VPI_BORDER_REFLECT

edcba|abcde|edcba

VPI_BORDER_MIRROR

dedcb|abcde|dcbab

Definition at line 217 of file Types.h.

## ◆ VPIEventState

 enum VPIEventState

#include <vpi/Types.h>

Defines the states of the event.

Enumerator
VPI_EVENT_STATE_NOT_SIGNALED

Event is not signaled yet.

VPI_EVENT_STATE_SIGNALED

Event has been signaled.

Definition at line 426 of file Types.h.

## ◆ VPIInterpolationType

 enum VPIInterpolationType

#include <vpi/Interpolation.h>

Interpolation types supported by several algorithms.

Enumerator
VPI_INTERP_NEAREST

Nearest neighbor interpolation.

$P(x,y) = \mathit{in}[\lfloor x+0.5 \rfloor, \lfloor y+0.5 \rfloor]$

VPI_INTERP_LINEAR

Linear interpolation.

Interpolation weights are defined as:

\begin{align*} w_0(t)& \triangleq t-\lfloor t \rfloor \\ w_1(t)& \triangleq 1 - w_0(t) \\ \end{align*}

Bilinear-interpolated value is given by the formula below:

$P(x,y) = \sum_{p=0}^1 \sum_{q=0}^1 \mathit{in}[\lfloor x \rfloor+p, \lfloor y \rfloor+q]w_p(x)w_q(y)$

VPI_INTERP_CATMULL_ROM

Catmull-Rom cubic interpolation.

Catmull-Rom interpolation weights with $$A=-0.5$$ are defined as follows:

\begin{eqnarray*} w_0(t) &\triangleq& A(t+1)^3 &-& 5A(t+1)^2 &+& 8A(t+1) &-& 4A \\ w_1(t) &\triangleq& (A+2)t^3 &-& (A+3)t^2 &\nonumber& &+& 1 \\ w_2(t) &\triangleq& (A+2)(1-t)^3 &-& (A+3)(1-t)^2 &\nonumber& &+& 1 \\ w_3(t) &\triangleq& \rlap{1 - w_0(t) - w_1(t) - w_2(t) } \end{eqnarray*}

Bicubic-interpolated value is given by the formula below:

$P(x,y) = \sum_{p=-1}^2 \sum_{q=-1}^2 \mathit{in}[\lfloor x \rfloor+p, \lfloor y \rfloor+q]w_p(x)w_q(y)$

Definition at line 69 of file Interpolation.h.

## ◆ VPILockMode

 enum VPILockMode

#include <vpi/Types.h>

Defines the lock modes used by memory lock functions.

Enumerator

Writing to the memory when locking for reading leads to undefined behavior.

VPI_LOCK_WRITE

Lock memory only for writing.

Reading to the memory when locking for reading leads to undefined behavior. It is expected that the whole memory is written to. If there are regions not written, it might not be updated correctly during unlock. In this case, it's better to use VPI_LOCK_READ_WRITE.

It might be slightly efficient to lock only for writing, specially when performing non-shared memory mapping.