Defines the VPIWarpMap object and related functions. More...
Data Structures | |
struct | VPIWarpGrid |
Holds VPI's warp grid definition. More... | |
struct | VPIWarpMap |
Defines the mapping between input and output images' pixels. More... | |
Functions | |
VPIStatus | vpiWarpMapAllocData (VPIWarpMap *warpMap) |
Allocates the warp map's control point array for a given warp grid. More... | |
void | vpiWarpMapFreeData (VPIWarpMap *warpMap) |
Deallocates the warp map control points allocated by vpiWarpMapAllocData. More... | |
VPIStatus | vpiWarpMapGenerateIdentity (VPIWarpMap *warpMap) |
Fills the given warp map with an identity mapping. More... | |
#define | VPI_WARPGRID_MAX_HORIZ_REGIONS_COUNT 4 |
Maximum number of regions horizontally in a warp grid. | |
#define | VPI_WARPGRID_MAX_VERT_REGIONS_COUNT 4 |
Maximum number of regions vertically in a warp grid. | |
#define | VPI_WARPGRID_MIN_REGION_WIDTH 64 |
Minimum warp grid region width. | |
#define | VPI_WARPGRID_MIN_REGION_HEIGHT 16 |
Minimum warp grid region height. | |
Defines the VPIWarpMap object and related functions.
Warp map holds the mapping from output to input images, used in Remap algorithm. It allows both dense and sparse mapping.
struct VPIWarpGrid |
Holds VPI's warp grid definition.
This structure defines the layout of the control points in the destination image of a remap operation.
The control points are used as the basis for geometric transformation from source image to destination image. The remaining points are transformed based on the interpolation. Thus the density of the control points controls the quality of the geometric transformation.
This is an example of defining regions in the image:
This is an example of defining control points in one region:
Here's an example of a WxH dense grid definition:
regionWidth[0]
to regionWidth[numHorizRegions-2]
must be aligned to VPI_WARPGRID_MIN_REGION_WIDTH and at least VPI_WARPGRID_MIN_REGION_WIDTH.regionWidth[numHorizRegions-1]
must be at least VPI_WARPGRID_MIN_REGION_WIDTH.regionHeight[0]
to regionHeight[numVertRegions-2]
must be aligned to VPI_WARPGRID_MIN_REGION_HEIGHT and at least VPI_WARPGRID_MIN_REGION_HEIGHT.regionHeight[numVertRegions-1]
must be at least VPI_WARPGRID_MIN_REGION_HEIGHT. Definition at line 156 of file WarpGrid.h.
Data Fields | ||
---|---|---|
int16_t | horizInterval[VPI_WARPGRID_MAX_HORIZ_REGIONS_COUNT] |
Horizontal spacing between control points within a given region. Must be power-of-two. |
int8_t | numHorizRegions | Number of regions horizontally. |
int8_t | numVertRegions | Number of regions vertically. |
int16_t | regionHeight[VPI_WARPGRID_MAX_VERT_REGIONS_COUNT] | Height of each region. |
int16_t | regionWidth[VPI_WARPGRID_MAX_HORIZ_REGIONS_COUNT] | Width of each region. |
int16_t | vertInterval[VPI_WARPGRID_MAX_VERT_REGIONS_COUNT] |
Vertical spacing between control points within a given region. Must be power-of-two. |
struct VPIWarpMap |
Defines the mapping between input and output images' pixels.
This structure is used as input to Remap. It defines the control point positions in the input image. The corresponding positions in the output image is implicitly defined by the warp grid definition.
Data Fields | ||
---|---|---|
VPIWarpGrid | grid |
Warp grid control point structure definition. It implicitly defines the control point positions in the output image. |
VPIKeypoint * | keypoints |
Pointer to an array with control point positions in the input image corresponding to those in the output image. Coordinates are absolute, (0,0) is the top/left corner of output image. |
int16_t | numHorizPoints |
Number of points horizontally. Must match the number of points defined by the grid. This is calculated by vpiWarpMapAllocData. |
int16_t | numVertPoints |
Number of points vertically. Must match the number of points defined by the grid. This is calculated by vpiWarpMapAllocData. |
int32_t | pitchBytes |
Number of bytes between one control point and the one immediately below. Must be at least |
VPIStatus vpiWarpMapAllocData | ( | VPIWarpMap * | warpMap | ) |
#include <vpi/WarpMap.h>
Allocates the warp map's control point array for a given warp grid.
This function will read the warp grid structure and allocated an appropriately sized control point array, filling the numHorizPoints, numVertPoints, strideBytes and keypoints attributes of VPIWarpMap. The warp map must be deallocated by vpiWarpMapFreeData when no longer needed.
[in,out] | warpMap | The warp map whose keypoint array will be allocated. The warp grid attribute must be already filled out with the grid structure. keypoints must be NULL. All attributes other then grid and keypoints will be overwriten. |
void vpiWarpMapFreeData | ( | VPIWarpMap * | warpMap | ) |
#include <vpi/WarpMap.h>
Deallocates the warp map control points allocated by vpiWarpMapAllocData.
This function does nothing if control points array is NULL. It sets numHorizPoints
, numVertPoints
and strideBytes
to zero, and keypoints
to NULL.
[in,out] | warpMap | Warp map whose control points array needs to be deallocated. |
VPIStatus vpiWarpMapGenerateIdentity | ( | VPIWarpMap * | warpMap | ) |
#include <vpi/WarpMap.h>
Fills the given warp map with an identity mapping.
This function is useful if the user wants to specify their own mapping. It sets the control points coordinates to the destination coordinates as defined implicitly by the warp grid. The user then can iterate through these points and apply a custom mapping function to each one.
[in,out] | warpMap | Warp map with allocated control point array to be filled with identity mapping. |