SPDX-FileCopyrightText: Copyright (c) 2017-18 NVIDIA CORPORATION & AFFILIATES.
All rights reserved. SPDX-License-Identifier: LicenseRef-NvidiaProprietary
NVIDIA CORPORATION, its affiliates and licensors retain all intellectual property and proprietary rights in and to this material, related documentation and any modifications thereto. Any use, reproduction, disclosure or distribution of this material and related documentation without an express license agreement from NVIDIA CORPORATION or its affiliates is strictly prohibited.
360 Image and Coordinate Warp SDK.
Definition in file NVWarp360.h.
Go to the source code of this file.
Data Structures | |
struct | nvwarpParams_t |
Parameter structure. More... | |
struct | nvwarpYUVRGBParams_t |
Parameters for YUV:420:NV12 --> RGBA conversion. More... | |
Macros | |
#define | NVWARPAPI |
export tag More... | |
#define | NVWARP_VERSION_MAJOR(version) (((v) >> 24) & 0xff) |
Helper function to extract the major part of the version returned by nvwarpVersion(). More... | |
#define | NVWARP_VERSION_MINOR(version) (((v) >> 16) & 0xff) |
Helper function to extract the minor part of the version returned by nvwarpVersion(). More... | |
#define | NVWARP_VERSION_REVISION(version) (((v) >> 8) & 0xff) |
Helper function to extract the revision part of the version returned by nvwarpVersion(). More... | |
Typedefs | |
typedef enum nvwarpResult | nvWarpResult |
Error code enumerations for NVWarp360. More... | |
typedef enum nvwarpSurface_t | nvwarpSurface_t |
typedef enum nvwarpType_t | nvwarpType_t |
Warp type enumeration. More... | |
typedef struct nvwarpParams_t | nvwarpParams_t |
Parameter structure. More... | |
typedef struct nvwarpObject * | nvwarpHandle |
Opaque definition of a pointer to the Warp360 state. More... | |
typedef struct nvwarpYUVRGBParams_t | nvwarpYUVRGBParams_t |
Parameters for YUV:420:NV12 --> RGBA conversion. More... | |
Enumerations | |
enum | nvwarpResult { NVWARP_SUCCESS = 0, NVWARP_ERR_GENERAL = 1, NVWARP_ERR_UNIMPLEMENTED = 2, NVWARP_ERR_DOMAIN = 3, NVWARP_ERR_MISSING_PARAMETERS = 4, NVWARP_ERR_PARAMETER = 5, NVWARP_ERR_INITIALIZATION = 6, NVWARP_ERR_CUDA_MEMORY = 7, NVWARP_ERR_CUDA_LAUNCH = 8, NVWARP_ERR_CUDA_DRIVER = 9, NVWARP_ERR_CUDA_NO_KERNEL = 10, NVWARP_ERR_CUDA = 11, NVWARP_ERR_APPROXIMATE = 12, NVWARP_ERR_MAX = 0x7fffffff } |
Error code enumerations for NVWarp360. More... | |
enum | nvwarpSurface_t { NVSURF_PERSPECTIVE = 0, NVSURF_FISHEYE = 1, NVSURF_EQUIRECT = 2, NVSURF_CYLINDER = 3, NVSURF_ROTCYLINDER = 4, NVSURF_PUSHBROOM = 5, NVSURF_PANINI = 6, NVSURF_STEREOGRAPHIC = 7, NVSURF_BITS = 8, NVSURF_UNKNOWN = ((1 << NVSURF_BITS) - 1), NVSURF_MASK = ((1 << NVSURF_BITS) - 1), NVSURF_MAX = 0x7fffffff } |
enum | nvwarpType_t { NVWARP_EQUIRECT_CYLINDER = (NVSURF_EQUIRECT << NVSURF_BITS) | NVSURF_CYLINDER, NVWARP_EQUIRECT_EQUIRECT = (NVSURF_EQUIRECT << NVSURF_BITS) | NVSURF_EQUIRECT, NVWARP_EQUIRECT_FISHEYE = (NVSURF_EQUIRECT << NVSURF_BITS) | NVSURF_FISHEYE, NVWARP_EQUIRECT_PANINI = (NVSURF_EQUIRECT << NVSURF_BITS) | NVSURF_PANINI, NVWARP_EQUIRECT_PERSPECTIVE = (NVSURF_EQUIRECT << NVSURF_BITS) | NVSURF_PERSPECTIVE, NVWARP_EQUIRECT_PUSHBROOM = (NVSURF_EQUIRECT << NVSURF_BITS) | NVSURF_PUSHBROOM, NVWARP_EQUIRECT_STEREOGRAPHIC = (NVSURF_EQUIRECT << NVSURF_BITS) | NVSURF_STEREOGRAPHIC, NVWARP_EQUIRECT_ROTCYLINDER = (NVSURF_EQUIRECT << NVSURF_BITS) | NVSURF_ROTCYLINDER, NVWARP_FISHEYE_CYLINDER = (NVSURF_FISHEYE << NVSURF_BITS) | NVSURF_CYLINDER, NVWARP_FISHEYE_EQUIRECT = (NVSURF_FISHEYE << NVSURF_BITS) | NVSURF_EQUIRECT, NVWARP_FISHEYE_FISHEYE = (NVSURF_FISHEYE << NVSURF_BITS) | NVSURF_FISHEYE, NVWARP_FISHEYE_PANINI = (NVSURF_FISHEYE << NVSURF_BITS) | NVSURF_PANINI, NVWARP_FISHEYE_PERSPECTIVE = (NVSURF_FISHEYE << NVSURF_BITS) | NVSURF_PERSPECTIVE, NVWARP_FISHEYE_PUSHBROOM = (NVSURF_FISHEYE << NVSURF_BITS) | NVSURF_PUSHBROOM, NVWARP_FISHEYE_ROTCYLINDER = (NVSURF_FISHEYE << NVSURF_BITS) | NVSURF_ROTCYLINDER, NVWARP_PERSPECTIVE_EQUIRECT = (NVSURF_PERSPECTIVE << NVSURF_BITS) | NVSURF_EQUIRECT, NVWARP_PERSPECTIVE_PANINI = (NVSURF_PERSPECTIVE << NVSURF_BITS) | NVSURF_PANINI, NVWARP_PERSPECTIVE_PERSPECTIVE = (NVSURF_PERSPECTIVE << NVSURF_BITS) | NVSURF_PERSPECTIVE, NVWARP_NONE = 0xffffffff } |
Warp type enumeration. More... | |
Functions | |
void NVWARPAPI | nvwarpInitParams (nvwarpParams_t *params) |
Initialize nvwarpParams_t to defaults or NaN if a particular parameter must be supplied. More... | |
nvwarpResult NVWARPAPI | nvwarpComputeParamsSrcFocalLength (nvwarpParams_t *params, float angle, float radius) |
Compute and set the srcFocalLen given the warp type and srcDist distortion coefficients, plus an angle and corresponding radius. More... | |
nvwarpResult NVWARPAPI | nvwarpComputeParamsOutputResolution (nvwarpParams_t *params, float aspectRatio) |
Compute the output resolution that matches the source focal length and desired aspect ratio. More... | |
nvwarpResult NVWARPAPI | nvwarpComputeParamsAxialAngleRange (const nvwarpParams_t *params, float minMaxXY[4]) |
Compute the angular limits on the source image along the primary axes going through the center of projection. More... | |
nvwarpResult NVWARPAPI | nvwarpComputeBoxAxialAngleRange (const nvwarpParams_t *params, const float srcBoundingBox[4], float minMaxXY[4]) |
Compute the angular limits on the source bounding box along the primary axes going through the center of projection. More... | |
nvwarpResult NVWARPAPI | nvwarpCreateInstance (nvwarpHandle *han) |
Constructor for a new instance of a Warp360 object. More... | |
void NVWARPAPI | nvwarpDestroyInstance (nvwarpHandle han) |
Destructor for a Warp360 object. More... | |
uint32_t NVWARPAPI | nvwarpVersion () |
Get the version number, encoded as (major_version * 16777216u + minor * 65536u + revision * 256u). More... | |
const char *NVWARPAPI | nvwarpErrorStringFromCode (nvwarpResult err) |
Get the error string corresponding to the given result code. More... | |
nvwarpResult NVWARPAPI | nvwarpSetParams (nvwarpHandle han, const nvwarpParams_t *params) |
Set parameters for a warp. More... | |
void NVWARPAPI | nvwarpGetParams (const nvwarpHandle han, nvwarpParams_t *params) |
Get the current values of the warp parameters. More... | |
nvwarpResult NVWARPAPI | nvwarpSetWarpType (nvwarpHandle han, nvwarpType_t type) |
Set the warp type. More... | |
nvwarpType_t NVWARPAPI | nvwarpGetWarpType (const nvwarpHandle han) |
Get the type of the warp. More... | |
void NVWARPAPI | nvwarpSetBlock (nvwarpHandle han, dim3 dim_block) |
Set the CUDA block size. More... | |
void NVWARPAPI | nvwarpGetBlock (const nvwarpHandle han, dim3 *dim_block) |
Get the current value of the CUDA block size. More... | |
void NVWARPAPI | nvwarpSetPixelPhase (nvwarpHandle han, uint32_t phase) |
Set the pixel phase. More... | |
uint32_t NVWARPAPI | nvwarpGetPixelPhase (const nvwarpHandle han) |
Get the pixel phase. More... | |
void NVWARPAPI | nvwarpSetSrcWidthHeight (nvwarpHandle han, uint32_t w, uint32_t h) |
Set the source dimensions. More... | |
void NVWARPAPI | nvwarpGetSrcWidthHeight (const nvwarpHandle han, uint32_t wh[2]) |
Get the source image dimensions. More... | |
void NVWARPAPI | nvwarpSetSrcFocalLengths (nvwarpHandle han, float fl, float fy) |
Set the source focal length. More... | |
nvwarpResult NVWARPAPI | nvwarpComputeSrcFocalLength (nvwarpHandle han, nvwarpType_t warpType, float radius, float angle, float dist[5]) |
Compute the source focal length, primarily from a radius and corresponding angle (e.g. More... | |
float NVWARPAPI | nvwarpGetSrcFocalLength (const nvwarpHandle han, float *fy) |
Get one or both source focal lengths. More... | |
void NVWARPAPI | nvwarpSetSrcPrincipalPoint (nvwarpHandle han, const float xy[2], uint32_t relToCenter) |
Specify the principal point of the source image. More... | |
void NVWARPAPI | nvwarpGetSrcPrincipalPoint (const nvwarpHandle han, float xy[2], uint32_t relToCenter) |
Get the source principal point. More... | |
void NVWARPAPI | nvwarpSetSrcRadius (nvwarpHandle han, float r) |
set the source fisheye clipping radius. More... | |
float NVWARPAPI | nvwarpGetSrcRadius (const nvwarpHandle han) |
Get the source fisheye clipping radius. More... | |
void NVWARPAPI | nvwarpSetDistortion (nvwarpHandle han, const float d[5]) |
Set the distortion coefficients. More... | |
void NVWARPAPI | nvwarpGetDistortion (const nvwarpHandle han, float d[5]) |
Get the distortion coefficients. More... | |
void NVWARPAPI | nvwarpSetRotation (nvwarpHandle han, const float R[9]) |
Specify the rotation. More... | |
void NVWARPAPI | nvwarpSetEulerRotation (nvwarpHandle han, const float *angles, const char *axes) |
Specify the view rotation, using a list of angles and their respective axes of rotation. More... | |
void NVWARPAPI | nvwarpGetRotation (const nvwarpHandle han, float R[9]) |
Get the rotation matrix. More... | |
void NVWARPAPI | nvwarpSetDstWidthHeight (nvwarpHandle han, uint32_t w, uint32_t h) |
Set the destination width and height. More... | |
void NVWARPAPI | nvwarpGetDstWidthHeight (const nvwarpHandle han, uint32_t wh[2]) |
Get the destination width and height. More... | |
void NVWARPAPI | nvwarpSetDstFocalLengths (nvwarpHandle han, float fl, float fy) |
Set the destination focal length. More... | |
void NVWARPAPI | nvwarpComputeDstFocalLength (nvwarpHandle han, float topAngle, float bottomAngle, uint32_t dstWidth, uint32_t dstHeight) |
From the vertical view angles, this sets the identical destination focal lengths, plus width and height. More... | |
nvwarpResult NVWARPAPI | nvwarpComputeDstFocalLengths (nvwarpHandle han, float topAxialAngle, float botAxialAngle, float leftAxialAngle, float rightAxialAngle, uint32_t dstWidth, uint32_t dstHeight) |
From the vertical and horizontal axial view angles, this sets the anisotropic destination focal lengths, asymmetric center of projection, width and height. More... | |
float NVWARPAPI | nvwarpGetDstFocalLength (const nvwarpHandle han, float *fy) |
Get one or both destination focal lengths. More... | |
void NVWARPAPI | nvwarpSetDstPrincipalPoint (nvwarpHandle han, const float xy[2], uint32_t relToCenter) |
Set the destination principal point. More... | |
void NVWARPAPI | nvwarpGetDstPrincipalPoint (const nvwarpHandle han, float xy[2], uint32_t relToCenter) |
Get the destination principal point. More... | |
void NVWARPAPI | nvwarpSetControl (nvwarpHandle han, uint32_t index, float control) |
Set a control parameter. More... | |
float NVWARPAPI | nvwarpGetControl (const nvwarpHandle han, uint32_t index) |
Get the value for the control parameters. More... | |
void NVWARPAPI | nvwarpSetUserData (nvwarpHandle han, void *userData) |
Set the user data pointer. More... | |
void *NVWARPAPI | nvwarpGetUserData (nvwarpHandle han) |
Get the current value of the user data pointer. More... | |
nvwarpResult NVWARPAPI | nvwarpWarpSurface (const nvwarpHandle han, cudaStream_t stream, cudaTextureObject_t srcTex, cudaSurfaceObject_t dstSurface) |
Warp an image texture to a surface. More... | |
nvwarpResult NVWARPAPI | nvwarpWarpBuffer (const nvwarpHandle han, cudaStream_t stream, cudaTextureObject_t srcTex, void *dstAddr, size_t dstRowBytes) |
Warp an image texture to a buffer. More... | |
nvwarpResult NVWARPAPI | nvwarpWarpCoordinates (const nvwarpHandle han, uint32_t numPts, const float *inPtsXY, float *outPtsXY) |
Transform coordinates from the input space to the output space. More... | |
nvwarpResult NVWARPAPI | nvwarpInverseWarpCoordinates (const nvwarpHandle han, uint32_t numPts, const float *inPtsXY, float *outPtsXY) |
Transform coordinates from the destination space to the source space. More... | |
nvwarpResult NVWARPAPI | nvwarpSrcToRay (const nvwarpHandle han, uint32_t numPts, const float *pts2D, float *rays3D) |
Convert source coordinates into normalized rays. More... | |
nvwarpResult NVWARPAPI | nvwarpDstToRay (const nvwarpHandle han, uint32_t numPts, const float *pts2D, float *rays3D) |
Convert destination coordinates into normalized rays. More... | |
nvwarpResult NVWARPAPI | nvwarpSrcFromRay (const nvwarpHandle han, uint32_t numRays, const float *rays3D, float *pts2D) |
Convert rays into source coordinates. More... | |
nvwarpResult NVWARPAPI | nvwarpDstFromRay (const nvwarpHandle han, uint32_t numRays, const float *rays3D, float *pts2D) |
Convert rays into destination coordinates. More... | |
nvwarpResult NVWARPAPI | nvwarpComputeSrcAngularFromPixelCoordinates (const nvwarpHandle han, uint32_t numPts, const float *pts2D, float *ang2D) |
Compute the angular coordinates {longitude, latitude} of for the given points in the source. More... | |
nvwarpResult NVWARPAPI | nvwarpComputeSrcPixelFromAngularCoordinates (const nvwarpHandle han, uint32_t numPts, const float *ang2D, float *pts2D) |
Compute the pixel coordinates for the given angular coordinates {longitude, latitude} in the source. More... | |
nvwarpResult NVWARPAPI | nvwarpComputeDstAngularFromPixelCoordinates (const nvwarpHandle han, uint32_t numPts, const float *pts2D, float *ang2D) |
Compute the angular coordinates {longitude, latitude} of for the given points in the destination. More... | |
nvwarpResult NVWARPAPI | nvwarpComputeDstPixelFromAngularCoordinates (const nvwarpHandle han, uint32_t numPts, const float *ang2D, float *pts2D) |
Compute the pixel coordinates for the given angular coordinates {longitude, latitude} in the destination. More... | |
void NVWARPAPI | nvwarpConvertTransformBetweenYUpandYDown (const float fr[9], float to[9]) |
Invert the sense of the Y- and Z-axes in the specified transformation, keeping the X axis pointing in the same direction, i.e. More... | |
void NVWARPAPI | nvwarpComputeYCbCr2RgbMatrix (nvwarpYUVRGBParams_t *p, uint32_t matrix_coefficients, uint32_t video_full_range_flag, uint32_t bit_depth, uint32_t normalized_input, uint32_t normalized_output) |
General method to compute all values except for {width, height, cLocation}. More... | |
nvwarpResult NVWARPAPI | nvwarpConvertYUVNV12ToRGBA (cudaStream_t stream, const nvwarpYUVRGBParams_t *params, const void *yuv, size_t yuvRowBytes, void *dst, size_t dstRowBytes) |
Perform YUV 4:2:0 NV12 --> RGBA conversion. More... | |
nvwarpResult NVWARPAPI | nvwarpMultiWarp360 (cudaStream_t stream, const nvwarpYUVRGBParams_t *yuvParams, const void *yuvBuffer, size_t yuvRowBytes, void *rgbBuffer, size_t rgbRowBytes, cudaTextureObject_t rgbTex, uint32_t numWarps, const nvwarpParams_t *paramArray, void **dstBuffers, const size_t *dstRowBytes) |
Perform an optional YUV:420:NV12 --> RGBA conversion, followed by a suite of warps from that conversion. More... | |
#define NVWARP_VERSION_MAJOR | ( | version | ) | (((v) >> 24) & 0xff) |
Helper function to extract the major part of the version returned by nvwarpVersion().
[in] | version | the version, as returned by nvwarpVersion(). |
Definition at line 279 of file NVWarp360.h.
#define NVWARP_VERSION_MINOR | ( | version | ) | (((v) >> 16) & 0xff) |
Helper function to extract the minor part of the version returned by nvwarpVersion().
[in] | version | the version, as returned by nvwarpVersion(). |
Definition at line 284 of file NVWarp360.h.
#define NVWARP_VERSION_REVISION | ( | version | ) | (((v) >> 8) & 0xff) |
Helper function to extract the revision part of the version returned by nvwarpVersion().
[in] | version | the version, as returned by nvwarpVersion(). |
Definition at line 289 of file NVWarp360.h.
#define NVWARPAPI |
export tag
Definition at line 31 of file NVWarp360.h.
typedef struct nvwarpObject* nvwarpHandle |
Opaque definition of a pointer to the Warp360 state.
Definition at line 250 of file NVWarp360.h.
typedef struct nvwarpParams_t nvwarpParams_t |
typedef enum nvwarpResult nvWarpResult |
Error code enumerations for NVWarp360.
Error code typedef for NVWarp360.
typedef enum nvwarpSurface_t nvwarpSurface_t |
typedef enum nvwarpType_t nvwarpType_t |
Warp type enumeration.
Warp type typedef.
typedef struct nvwarpYUVRGBParams_t nvwarpYUVRGBParams_t |
Parameters for YUV:420:NV12 --> RGBA conversion.
enum nvwarpResult |
Error code enumerations for NVWarp360.
Definition at line 45 of file NVWarp360.h.
enum nvwarpSurface_t |
Definition at line 64 of file NVWarp360.h.
enum nvwarpType_t |
Warp type enumeration.
Definition at line 82 of file NVWarp360.h.
nvwarpResult NVWARPAPI nvwarpComputeBoxAxialAngleRange | ( | const nvwarpParams_t * | params, |
const float | srcBoundingBox[4], | ||
float | minMaxXY[4] | ||
) |
Compute the angular limits on the source bounding box along the primary axes going through the center of projection.
The nvwarpParams_t must have the following fields filled in: type, srcX0, srcY0, srcFocalLen, srcDist[4];
[in] | params | the Warp360 parameters. |
[in] | srcBoundingBox | an array of length 4 for describing bounding box in source image {leftTopX, leftTopY, bottomRightX, bottomRightY}. |
[out] | minMaxXY | an array of length 4, where the values {minX, maxX, minY, maxY} angles, in radians, are returned. |
nvwarpResult NVWARPAPI nvwarpComputeDstAngularFromPixelCoordinates | ( | const nvwarpHandle | han, |
uint32_t | numPts, | ||
const float * | pts2D, | ||
float * | ang2D | ||
) |
Compute the angular coordinates {longitude, latitude} of for the given points in the destination.
[in] | han | the Warp360 instance. |
[in] | numPts | the number of points to be converted into rays. |
[in] | pts2D | the array of 2D points to be transformed into 3D rays. |
[out] | ang2D | the array into which the 2D angles are to be placed. NANs are returned for unsuccessful conversions. |
void NVWARPAPI nvwarpComputeDstFocalLength | ( | nvwarpHandle | han, |
float | topAngle, | ||
float | bottomAngle, | ||
uint32_t | dstWidth, | ||
uint32_t | dstHeight | ||
) |
From the vertical view angles, this sets the identical destination focal lengths, plus width and height.
The view angles are measured in the center of a symmetric view. The warp type must already be chosen before calling.
[in,out] | han | the Warp360 instance. |
[in] | topAngle | the top view angle. |
[in] | bottomAngle | the bottom view angle. |
[in] | dstWidth | the width of the destination. |
[in] | dstHeight | the height of the destination. |
nvwarpResult NVWARPAPI nvwarpComputeDstFocalLengths | ( | nvwarpHandle | han, |
float | topAxialAngle, | ||
float | botAxialAngle, | ||
float | leftAxialAngle, | ||
float | rightAxialAngle, | ||
uint32_t | dstWidth, | ||
uint32_t | dstHeight | ||
) |
From the vertical and horizontal axial view angles, this sets the anisotropic destination focal lengths, asymmetric center of projection, width and height.
The view angles are measured through the center of projection. The warp type must already be chosen before calling.
[in,out] | han | the Warp360 instance. |
[in] | topAxialAngle | the top view angle through the center of projection. |
[in] | botAxialAngle | the bottom view angle through the center of projection. |
[in] | leftAxialAngle | the left view angle through the center of projection. |
[in] | rightAxialAngle | the right view angle through the center of projection. |
[in] | dstWidth | the width of the destination. |
[in] | dstHeight | the height of the destination. |
nvwarpResult NVWARPAPI nvwarpComputeDstPixelFromAngularCoordinates | ( | const nvwarpHandle | han, |
uint32_t | numPts, | ||
const float * | ang2D, | ||
float * | pts2D | ||
) |
Compute the pixel coordinates for the given angular coordinates {longitude, latitude} in the destination.
[in] | han | the Warp360 instance. |
[in] | numPts | the number of angle pairs to be converted into 2D points. |
[in] | ang2D | the array of 2D angles to be converted into 2D points. |
[out] | pts2D | the array into which the 2D points are to be placed. NANs are returned for unsuccessful conversions. |
nvwarpResult NVWARPAPI nvwarpComputeParamsAxialAngleRange | ( | const nvwarpParams_t * | params, |
float | minMaxXY[4] | ||
) |
Compute the angular limits on the source image along the primary axes going through the center of projection.
The nvwarpParams_t must have the following fields filled in: type, srcWidth, srcHeight, srcX0, srcY0, srcFocalLen, srcDist[4];
[in] | params | the Warp360 parameters. |
[out] | minMaxXY | an array of length 4, where the values {minX, maxX, minY, maxY} angles, in radians, are returned. |
nvwarpResult NVWARPAPI nvwarpComputeParamsOutputResolution | ( | nvwarpParams_t * | params, |
float | aspectRatio | ||
) |
Compute the output resolution that matches the source focal length and desired aspect ratio.
The dimensions are computed from the source focal length, so it must already have the appropriate value.
[in,out] | params | the Warp360 parameters. |
[in] | aspectRatio | the ratio of width/height for the output. |
nvwarpResult NVWARPAPI nvwarpComputeParamsSrcFocalLength | ( | nvwarpParams_t * | params, |
float | angle, | ||
float | radius | ||
) |
Compute and set the srcFocalLen given the warp type and srcDist distortion coefficients, plus an angle and corresponding radius.
The srcDist[] coefficients must be initialized prior to the call (suggest {0,0,0,0} for ideal lens). The focal length converts from angles to pixels at the center of projection, and is a measure of spherical image resolution also known as angular pixel density (in pixels/radian). It is only as accurate as the parameters that were supplied. It can be adjusted by hand, for example to straighten out lines that appeared bowed, but distortion does that as well.
[in,out] | params | the Warp360 parameters to be set. |
[in] | angle | the angle in radians. |
[in] | radius | the radius, in pixels, corresponding to the angle above. |
nvwarpResult NVWARPAPI nvwarpComputeSrcAngularFromPixelCoordinates | ( | const nvwarpHandle | han, |
uint32_t | numPts, | ||
const float * | pts2D, | ||
float * | ang2D | ||
) |
Compute the angular coordinates {longitude, latitude} of for the given points in the source.
[in] | han | the Warp360 instance. |
[in] | numPts | the number of 2D points to be converted into angles. |
[in] | pts2D | the array of 2D points to be transformed into 2D angles. |
[out] | ang2D | the array into which the 2D angles are to be placed. NANs are returned for unsuccessful conversions. |
nvwarpResult NVWARPAPI nvwarpComputeSrcFocalLength | ( | nvwarpHandle | han, |
nvwarpType_t | warpType, | ||
float | radius, | ||
float | angle, | ||
float | dist[5] | ||
) |
Compute the source focal length, primarily from a radius and corresponding angle (e.g.
fov/2), and the warp type. The distortion also plays a part in with perspective and fisheye sources. The focal length converts from angles to pixels at the center of projection, and is a measure of spherical image resolution also known as angular pixel density (in pixels/radian). It is only as accurate as the parameters that were supplied. It can be adjusted by hand, for example to straighten out lines that appeared bowed, but distortion does that as well. This will set all of these parameters: srcFocalLengthX srcFocalLengthY warp type distortion
[in,out] | han | the Warp360 instance. |
[in] | warpType | the warp type. |
[in] | radius | a radius, i.e. distance from the principal point, e.g. to an edge. |
[in] | angle | the angle corresponding to the above radius, i.e. angular distance from the optical axis. |
[in] | dist | the distortion coefficients. (NULL implies (0,0,0,0,0). |
nvwarpResult NVWARPAPI nvwarpComputeSrcPixelFromAngularCoordinates | ( | const nvwarpHandle | han, |
uint32_t | numPts, | ||
const float * | ang2D, | ||
float * | pts2D | ||
) |
Compute the pixel coordinates for the given angular coordinates {longitude, latitude} in the source.
[in] | han | the Warp360 instance. |
[in] | numPts | the number of angle pairs to be converted into 2D points. |
[in] | ang2D | the array of 2D angles to be converted into 2D points. |
[out] | pts2D | the array into which the 2D points are to be placed. NANs are returned for unsuccessful conversions. |
void NVWARPAPI nvwarpComputeYCbCr2RgbMatrix | ( | nvwarpYUVRGBParams_t * | p, |
uint32_t | matrix_coefficients, | ||
uint32_t | video_full_range_flag, | ||
uint32_t | bit_depth, | ||
uint32_t | normalized_input, | ||
uint32_t | normalized_output | ||
) |
General method to compute all values except for {width, height, cLocation}.
[out] | p | the location of the parameters that will be set by this method. |
[in] | matrix_coefficients | One of {709, 1, 2} for BT.709, {601, 5, 6} for BT.601, {2020, 9, 10} for BT.2020, {4} for FCC, {240, 7} FOR SMPTE 240M. |
[in] | video_full_range_flag | 0 for standard video range (16-240), 1 for full range (0-255). |
[in] | bit_depth | 8 is the only depth that is supported by nvwarpConvertYUVNV12ToRGBA(). |
[in] | normalized_input | 1 if the input is normalized, 0 if not. |
[in] | normalized_output | 1 if the output is normalized, 0 if not. |
void NVWARPAPI nvwarpConvertTransformBetweenYUpandYDown | ( | const float | fr[9], |
float | to[9] | ||
) |
Invert the sense of the Y- and Z-axes in the specified transformation, keeping the X axis pointing in the same direction, i.e.
converting between {X-right, Y-up, Z-in} and {X-right, Y-down, Z-out}.
[in] | fr | the initial transformation to be converted. |
[out] | to | a place to store the converted transformation (can the same as fr). |
nvwarpResult NVWARPAPI nvwarpConvertYUVNV12ToRGBA | ( | cudaStream_t | stream, |
const nvwarpYUVRGBParams_t * | params, | ||
const void * | yuv, | ||
size_t | yuvRowBytes, | ||
void * | dst, | ||
size_t | dstRowBytes | ||
) |
Perform YUV 4:2:0 NV12 --> RGBA conversion.
[in] | stream | The stream on which the computation is to be performed. |
[in] | params | The parameters controlling the YUV-->RGB conversion; typically set with YUVRGBParams.computeMatrix(). |
[in] | yuv | Pointer to the YV CUDA pitched memory buffer. |
[in] | yuvRowBytes | Byte stride between pixels vertically in the luminance (and chrominance) of YUV. |
[in] | dst | Pointer to the RGBA CUDA pitched memory buffer. |
[in] | dstRowBytes | Byte stride between pixels vertically in the RGBA. |
nvwarpResult NVWARPAPI nvwarpCreateInstance | ( | nvwarpHandle * | han | ) |
Constructor for a new instance of a Warp360 object.
[out] | han | a place to store the new instance of Warp360 object. |
void NVWARPAPI nvwarpDestroyInstance | ( | nvwarpHandle | han | ) |
Destructor for a Warp360 object.
[in] | han | handle to a Warp360 object. Can be NULL. |
nvwarpResult NVWARPAPI nvwarpDstFromRay | ( | const nvwarpHandle | han, |
uint32_t | numRays, | ||
const float * | rays3D, | ||
float * | pts2D | ||
) |
Convert rays into destination coordinates.
The rays do not need to be normalized.
[in] | han | the Warp360 instance. |
[in] | numRays | the number of rays to be converted into points. |
[in] | rays3D | the array of 3D rays to be transformed into 2D points. |
[out] | pts2D | the array into which the 2D points are to be placed. NANs are returned for unsuccessful conversions. |
nvwarpResult NVWARPAPI nvwarpDstToRay | ( | const nvwarpHandle | han, |
uint32_t | numPts, | ||
const float * | pts2D, | ||
float * | rays3D | ||
) |
Convert destination coordinates into normalized rays.
[in] | han | the Warp360 instance. |
[in] | numPts | the number of points to be converted into rays. |
[in] | pts2D | the array of 2D points to be transformed into 3D rays. |
[out] | rays3D | the array into which the 3D rays are to be placed. NANs are returned for unsuccessful conversions. |
const char* NVWARPAPI nvwarpErrorStringFromCode | ( | nvwarpResult | err | ) |
Get the error string corresponding to the given result code.
[in] | err | the error code. |
void NVWARPAPI nvwarpGetBlock | ( | const nvwarpHandle | han, |
dim3 * | dim_block | ||
) |
Get the current value of the CUDA block size.
[in] | han | the Warp360 instance. |
[out] | dim_block | pointer to a location where the block size is to be stored. |
float NVWARPAPI nvwarpGetControl | ( | const nvwarpHandle | han, |
uint32_t | index | ||
) |
Get the value for the control parameters.
[in] | han | the Warp360 instance. |
[in] | index | the index of the control parameter to retrieve. |
void NVWARPAPI nvwarpGetDistortion | ( | const nvwarpHandle | han, |
float | d[5] | ||
) |
Get the distortion coefficients.
Note: an array of 5 must be supplied, even though only 4 are currently used. The fifth is reserved to implement the full Brown model for perspective images.
[in] | han | the Warp360 instance. |
[out] | d | the array where the distortion coefficients are to be stored. |
float NVWARPAPI nvwarpGetDstFocalLength | ( | const nvwarpHandle | han, |
float * | fy | ||
) |
Get one or both destination focal lengths.
In most cases, only a single focal length will be used, so NULL would be specified for the second parameter.
[in] | han | the Warp360 instance. |
[out] | fy | a place to store the Y focal length (can be NULL if it is not desired). |
void NVWARPAPI nvwarpGetDstPrincipalPoint | ( | const nvwarpHandle | han, |
float | xy[2], | ||
uint32_t | relToCenter | ||
) |
Get the destination principal point.
[in] | han | the Warp360 instance. |
[out] | xy | a place to store the destination principal point. |
[in] | relToCenter | 0 = relative to the upper left corner of the image, 1 = relative to the center of the image. |
void NVWARPAPI nvwarpGetDstWidthHeight | ( | const nvwarpHandle | han, |
uint32_t | wh[2] | ||
) |
Get the destination width and height.
[in] | han | the Warp360 instance. |
[out] | wh | an array in which to store the width and height. |
void NVWARPAPI nvwarpGetParams | ( | const nvwarpHandle | han, |
nvwarpParams_t * | params | ||
) |
Get the current values of the warp parameters.
[in] | han | the Warp360 instance. |
[out] | params | pointer to the location where the parameters are to be stored. |
uint32_t NVWARPAPI nvwarpGetPixelPhase | ( | const nvwarpHandle | han | ) |
Get the pixel phase.
[in] | han | the Warp360 instance. |
void NVWARPAPI nvwarpGetRotation | ( | const nvwarpHandle | han, |
float | R[9] | ||
) |
Get the rotation matrix.
This is one in which the Y-axis is directed downward, and the Z axis out.
[in] | han | the Warp360 instance. |
[out] | R | a place to store the current rotation matrix. |
float NVWARPAPI nvwarpGetSrcFocalLength | ( | const nvwarpHandle | han, |
float * | fy | ||
) |
Get one or both source focal lengths.
In most cases, there will only be one focal length, so this will be called with NULL as the second parameter.
[in] | han | the Warp360 instance. |
[out] | fy | a place to store the Y focal length. (can be NULL if only one focal length is desired). |
void NVWARPAPI nvwarpGetSrcPrincipalPoint | ( | const nvwarpHandle | han, |
float | xy[2], | ||
uint32_t | relToCenter | ||
) |
Get the source principal point.
[in] | han | the Warp360 instance. |
[out] | xy | a place to store the source principal point. |
[in] | relToCenter | zero = relative to the upper left corner of the image, nonzero = relative to the center of the image. |
float NVWARPAPI nvwarpGetSrcRadius | ( | const nvwarpHandle | han | ) |
Get the source fisheye clipping radius.
[in] | han | the Warp360 instance. |
void NVWARPAPI nvwarpGetSrcWidthHeight | ( | const nvwarpHandle | han, |
uint32_t | wh[2] | ||
) |
Get the source image dimensions.
[in] | han | the Warp360 instance. |
[out] | wh | a place to store the source width (wh[0]) and height (wh[1]). |
void* NVWARPAPI nvwarpGetUserData | ( | nvwarpHandle | han | ) |
Get the current value of the user data pointer.
[in] | han | the Warp360 instance. |
nvwarpType_t NVWARPAPI nvwarpGetWarpType | ( | const nvwarpHandle | han | ) |
Get the type of the warp.
[in] | han | the Warp360 instance. |
void NVWARPAPI nvwarpInitParams | ( | nvwarpParams_t * | params | ) |
Initialize nvwarpParams_t to defaults or NaN if a particular parameter must be supplied.
[out] | params | the parameter block to initialize. |
nvwarpResult NVWARPAPI nvwarpInverseWarpCoordinates | ( | const nvwarpHandle | han, |
uint32_t | numPts, | ||
const float * | inPtsXY, | ||
float * | outPtsXY | ||
) |
Transform coordinates from the destination space to the source space.
This works in-place.
[in] | han | the Warp360 instance. |
[in] | numPts | the number of points to be transformed. |
[in] | inPtsXY | an array of 2D points to be transformed. |
[out] | outPtsXY | a 2D point array of where the transformed 2D points are to be placed. This can be the same as inPtsXY. |
nvwarpResult NVWARPAPI nvwarpMultiWarp360 | ( | cudaStream_t | stream, |
const nvwarpYUVRGBParams_t * | yuvParams, | ||
const void * | yuvBuffer, | ||
size_t | yuvRowBytes, | ||
void * | rgbBuffer, | ||
size_t | rgbRowBytes, | ||
cudaTextureObject_t | rgbTex, | ||
uint32_t | numWarps, | ||
const nvwarpParams_t * | paramArray, | ||
void ** | dstBuffers, | ||
const size_t * | dstRowBytes | ||
) |
Perform an optional YUV:420:NV12 --> RGBA conversion, followed by a suite of warps from that conversion.
This uses an array of parameter blocks.
[in] | stream | Stream on which to perform this computation. |
[in] | yuvParams | Parameters for the YUV-->RGB conversion (can be NULL). |
[in] | yuvBuffer | The buffer containing the YUV data in 420 NV12 format. |
[in] | yuvRowBytes | The byte stride between luminance (and chroma) pixels vertically. |
[in] | rgbBuffer | The buffer where the YUV-->RGB conversion is to be placed. |
[in] | rgbRowBytes | The byte stride between RGBA pixels vertically. |
[in] | rgbTex | The texture associated with the RGB buffer, initialized appropriately. |
[in] | numWarps | The number of warps to be executed on using the RGB buffer texture as a source. |
[in] | paramArray | The array of parameter blocks for each warp. |
[out] | dstBuffers | The array of pointers to the destination buffers. |
[in] | dstRowBytes | The array of byte strides between pixels vertically, one for each warp. |
void NVWARPAPI nvwarpSetBlock | ( | nvwarpHandle | han, |
dim3 | dim_block | ||
) |
Set the CUDA block size.
[in,out] | han | the Warp360 instance. |
[in] | dim_block | the desired block size (default 8x8). |
void NVWARPAPI nvwarpSetControl | ( | nvwarpHandle | han, |
uint32_t | index, | ||
float | control | ||
) |
Set a control parameter.
Most warps do not have one. At the current time, no warps have more than 1 control parameter.
[in,out] | han | the Warp360 instance. |
[in] | index | the index of the control to be set. |
[in] | control | the desired control value. |
void NVWARPAPI nvwarpSetDistortion | ( | nvwarpHandle | han, |
const float | d[5] | ||
) |
Set the distortion coefficients.
[in,out] | han | the Warp360 instance. |
[in] | d | the list of distortion coefficients. Though only 4 are used at the moment, 5 are anticipated to be used to accommodate tangential distortion in the Brown perspective distortion model. For future compatibility, set d[3] = d[4] = 0 for perspective and d[4] = 0 for fisheye. If NULL is supplied for d, all coefficients are set to zero. |
void NVWARPAPI nvwarpSetDstFocalLengths | ( | nvwarpHandle | han, |
float | fl, | ||
float | fy | ||
) |
Set the destination focal length.
Typically, the same focal length is used for X and Y, but these can be different, if a second focal length is supplied. Focal length is a measure of the angular pixel density (in pixels/radian) at the principal point, so the effect of different focal lengths is anisotropic sampling, or rectangular rather than square pixels. To keep the same magnification, set the destination focal length equal to the source focal length. To zoom in by a factor of 2, double the focal length. Be careful when decreasing the focal length to avoid aliasing; you are probably safe down to a factor of 1/2, but you are most certainly going to manifest aliasing when going smaller than a factor of 1/3.
[in,out] | han | the Warp360 instance. |
[in] | fl | the desired X focal length. |
[in] | fy | the desired Y focal length. If zero, it is set to be identical to the X focal length. |
void NVWARPAPI nvwarpSetDstPrincipalPoint | ( | nvwarpHandle | han, |
const float | xy[2], | ||
uint32_t | relToCenter | ||
) |
Set the destination principal point.
[in,out] | han | the Warp360 instance. |
[in] | xy | the principal point. NULL implies (0,0). |
[in] | relToCenter | zero = the principal point is specified relative to the upper left corner of the image; nonzero = the principal point is specified relative to the center of the image. |
void NVWARPAPI nvwarpSetDstWidthHeight | ( | nvwarpHandle | han, |
uint32_t | w, | ||
uint32_t | h | ||
) |
Set the destination width and height.
[in,out] | han | the Warp360 instance. |
[in] | w | the desired destination width. |
[in] | h | the desired destination height. |
void NVWARPAPI nvwarpSetEulerRotation | ( | nvwarpHandle | han, |
const float * | angles, | ||
const char * | axes | ||
) |
Specify the view rotation, using a list of angles and their respective axes of rotation.
The image is considered to be straight ahead, and the sequence of rotations are applied to the viewer (camera). Alternatively one could maintain the camera facing forward, and instead rotate the image to embed it into 3D, by supplying the angles and axes in reverse order. Upward is the direction of positive rotation about the rightward-pointing X axis, Rightward is the direction of positive rotation about the downward-pointing Y axis, and Clockwise is the direction of positive rotation about the outward-pointing Z axis.
[in,out] | han | the Warp360 instance. |
[in] | angles | a list of angles, typically 3 for traditional Euler angles, but can be any size greater than 0. |
[in] | axes | the list of axes of rotation: upper-case 'X', 'Y', and 'Z' for the positive X-, Y- and Z-axes, and lower-case 'x', 'y', and 'z' for the negative X-, Y-, and Z- axes. The same axis may appear more than once, e.g. "ZXZ". This specification is for a coordinate system where the Y-axis is down and the Z-axis is out. For a coordinate system where Y goes up and Z comes in, invert the case of all 'Y' and 'Z' axis specifications. This string is 0-terminated, like any C-string; the length of the string determines how many rotations are concatenated. |
nvwarpResult NVWARPAPI nvwarpSetParams | ( | nvwarpHandle | han, |
const nvwarpParams_t * | params | ||
) |
Set parameters for a warp.
[out] | han | the Warp360 instance. |
[in] | params | pointer to the desired parameters for the warp. NULL initializes the parameters to NaN or default values as appropriate. |
void NVWARPAPI nvwarpSetPixelPhase | ( | nvwarpHandle | han, |
uint32_t | phase | ||
) |
Set the pixel phase.
[in,out] | han | the Warp360 instance. |
[in] | phase | zero = pixels are sampled on the integers, with valid pixel coordinates [0, width-1]. nonzero = pixels are sampled on the integers-plus-one-half, with valid pixel coordinates [0.5, width-0.5]. |
void NVWARPAPI nvwarpSetRotation | ( | nvwarpHandle | han, |
const float | R[9] | ||
) |
Specify the rotation.
By suitable construction, this can be used either as a projection (viewing) matrix, or an embedding (placement) matrix. The rotations are specified in a coordinate system where Y is down and Z is out. You can use the function convertTransformBetweenYUpandYDown() to convert representations to a coordinate system where Y is up and Z is in. The same function is used in either direction of conversion, and is used both for a projection or embedding matrix.
[in,out] | han | the Warp360 instance. |
[in] | R | the rotation transformation. This should be an orthonormal transformation, but is not enforced. NULL implies identity. |
void NVWARPAPI nvwarpSetSrcFocalLengths | ( | nvwarpHandle | han, |
float | fl, | ||
float | fy | ||
) |
Set the source focal length.
Typically, the same focal length is used for X and Y, but these can be different, if a second focal length is supplied. Focal length is a measure of the angular pixel density at the principal point, so the effect of different focal lengths is anisotropic sampling, or rectangular rather than square pixels.
[in,out] | han | the Warp360 instance. |
[in] | fl | the X focal length. |
[in] | fy | the Y focal length; if zero, the X focal length is used for Y as well. |
void NVWARPAPI nvwarpSetSrcPrincipalPoint | ( | nvwarpHandle | han, |
const float | xy[2], | ||
uint32_t | relToCenter | ||
) |
Specify the principal point of the source image.
[in,out] | han | the Warp360 instance. |
[in] | xy | the principal point. NULL implies (0,0). |
[in] | relToCenter | zero = the principal point is specified relative to the upper left corner of the image; nonzero = the principal point is specified relative to the center of the image. |
void NVWARPAPI nvwarpSetSrcRadius | ( | nvwarpHandle | han, |
float | r | ||
) |
set the source fisheye clipping radius.
[in,out] | han | the Warp360 instance. |
[in] | r | the fisheye clipping radius. No clipping is specified by r<=0. |
void NVWARPAPI nvwarpSetSrcWidthHeight | ( | nvwarpHandle | han, |
uint32_t | w, | ||
uint32_t | h | ||
) |
Set the source dimensions.
[in,out] | han | the Warp360 instance. |
[in] | w | the source width, in pixels. |
[in] | h | the source height, in pixels. |
void NVWARPAPI nvwarpSetUserData | ( | nvwarpHandle | han, |
void * | userData | ||
) |
Set the user data pointer.
[in,out] | han | the Warp360 instance. |
[in] | userData | pointer to the user data. |
nvwarpResult NVWARPAPI nvwarpSetWarpType | ( | nvwarpHandle | han, |
nvwarpType_t | type | ||
) |
Set the warp type.
[in,out] | han | the Warp360 instance. |
[in] | type | the warp type. |
nvwarpResult NVWARPAPI nvwarpSrcFromRay | ( | const nvwarpHandle | han, |
uint32_t | numRays, | ||
const float * | rays3D, | ||
float * | pts2D | ||
) |
Convert rays into source coordinates.
The rays do not need to be normalized.
[in] | han | the Warp360 instance. |
[in] | numRays | the number of rays to be converted into points. |
[in] | rays3D | the array of 3D rays to be transformed into 2D points. |
[out] | pts2D | the array into which the 2D points are to be placed. NANs are returned for unsuccessful conversions. |
nvwarpResult NVWARPAPI nvwarpSrcToRay | ( | const nvwarpHandle | han, |
uint32_t | numPts, | ||
const float * | pts2D, | ||
float * | rays3D | ||
) |
Convert source coordinates into normalized rays.
[in] | han | the Warp360 instance. |
[in] | numPts | the number of points to be converted into rays. |
[in] | pts2D | the array of 2D points to be transformed into 3D rays. |
[out] | rays3D | the array into which the 3D rays are to be placed. NANs are returned for unsuccessful conversions. |
uint32_t NVWARPAPI nvwarpVersion | ( | ) |
Get the version number, encoded as (major_version * 16777216u + minor * 65536u + revision * 256u).
For example, version 1.0.3 is represented as 0x01000300 = 16777984, version 2.0.0 is represented as 0x00090000 = 536870912, Typically, the major version is incremented when the API, other major changes, or backwards incompatibilities occur, the minor version is incremented when minor functionality changes such as new projections are added, the revision is incremented when a bug fix has been released. At most 256 revisions can occur before it is necessary to increment the minor version number, and at most 256 minor versions can occur before it is necessary to increment the major version number. The LS byte is for internal use only and should be 0. The macros below can be useful to extract the different parts of the version number.
nvwarpResult NVWARPAPI nvwarpWarpBuffer | ( | const nvwarpHandle | han, |
cudaStream_t | stream, | ||
cudaTextureObject_t | srcTex, | ||
void * | dstAddr, | ||
size_t | dstRowBytes | ||
) |
Warp an image texture to a buffer.
[in] | han | the Warp360 instance. |
[in] | stream | the stream on which to execute the warp. |
[in] | srcTex | the source texture. |
[out] | dstAddr | the destination buffer address. |
[in] | dstRowBytes | the byte stride between pixels in the buffer vertically. |
nvwarpResult NVWARPAPI nvwarpWarpCoordinates | ( | const nvwarpHandle | han, |
uint32_t | numPts, | ||
const float * | inPtsXY, | ||
float * | outPtsXY | ||
) |
Transform coordinates from the input space to the output space.
This works in-place.
[in] | han | the Warp360 instance. |
[in] | numPts | the number of points to be transformed. |
[in] | inPtsXY | an array of 2D points to be transformed. |
[out] | outPtsXY | a 2D point array of where the transformed 2D points are to be placed. This can be the same as inPtsXY. |
nvwarpResult NVWARPAPI nvwarpWarpSurface | ( | const nvwarpHandle | han, |
cudaStream_t | stream, | ||
cudaTextureObject_t | srcTex, | ||
cudaSurfaceObject_t | dstSurface | ||
) |
Warp an image texture to a surface.
[in] | han | the Warp360 instance. |
[in] | stream | the stream on which to execute the warp. |
[in] | srcTex | the source texture. |
[out] | dstSurface | the destination surface. |