NVIDIA DeepStream SDK API Reference

7.0 Release
NVWarp360.h File Reference

Detailed Description

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...
 

Macro Definition Documentation

◆ NVWARP_VERSION_MAJOR

#define NVWARP_VERSION_MAJOR (   version)    (((v) >> 24) & 0xff)

Helper function to extract the major part of the version returned by nvwarpVersion().

Parameters
[in]versionthe version, as returned by nvwarpVersion().
Returns
the major part of the version number.

Definition at line 279 of file NVWarp360.h.

◆ NVWARP_VERSION_MINOR

#define NVWARP_VERSION_MINOR (   version)    (((v) >> 16) & 0xff)

Helper function to extract the minor part of the version returned by nvwarpVersion().

Parameters
[in]versionthe version, as returned by nvwarpVersion().
Returns
the minor part of the version number.

Definition at line 284 of file NVWarp360.h.

◆ NVWARP_VERSION_REVISION

#define NVWARP_VERSION_REVISION (   version)    (((v) >> 8) & 0xff)

Helper function to extract the revision part of the version returned by nvwarpVersion().

Parameters
[in]versionthe version, as returned by nvwarpVersion().
Returns
the revision part of the version number.

Definition at line 289 of file NVWarp360.h.

◆ NVWARPAPI

#define NVWARPAPI

export tag

Definition at line 31 of file NVWarp360.h.

Typedef Documentation

◆ nvwarpHandle

typedef struct nvwarpObject* nvwarpHandle

Opaque definition of a pointer to the Warp360 state.

Definition at line 250 of file NVWarp360.h.

◆ nvwarpParams_t

Parameter structure.

Parameters typedef.

Definition at line 127 of file NVWarp360.h.

◆ nvWarpResult

typedef enum nvwarpResult nvWarpResult

Error code enumerations for NVWarp360.

Error code typedef for NVWarp360.

◆ nvwarpSurface_t

◆ nvwarpType_t

typedef enum nvwarpType_t nvwarpType_t

Warp type enumeration.

Warp type typedef.

◆ nvwarpYUVRGBParams_t

Parameters for YUV:420:NV12 --> RGBA conversion.

Enumeration Type Documentation

◆ nvwarpResult

Error code enumerations for NVWarp360.

Enumerator
NVWARP_SUCCESS 

The operation was successful.

NVWARP_ERR_GENERAL 

An otherwise unspecified failure has occurred.

NVWARP_ERR_UNIMPLEMENTED 

The requested feature has not yet been implemented.

NVWARP_ERR_DOMAIN 

The coordinates are outside of the domain.

NVWARP_ERR_MISSING_PARAMETERS 

Some required parameters have not been specified.

NVWARP_ERR_PARAMETER 

A parameter has an invalid value.

NVWARP_ERR_INITIALIZATION 

Initialization has not completed successfully.

NVWARP_ERR_CUDA_MEMORY 

There is not enough CUDA memory for the operation specified.

NVWARP_ERR_CUDA_LAUNCH 

CUDA was not able to launch the specified kernel.

NVWARP_ERR_CUDA_DRIVER 

CUDA driver version is insufficient for CUDA runtime version.

NVWARP_ERR_CUDA_NO_KERNEL 

No suitable CUDA kernel image has been found for this GPU.

NVWARP_ERR_CUDA 

An otherwise unspecified error has been reported by the CUDA runtime.

NVWARP_ERR_APPROXIMATE 

An accurate calculation is not available; approximation returned.

NVWARP_ERR_MAX 

This makes it 32 bits.

Definition at line 45 of file NVWarp360.h.

◆ nvwarpSurface_t

Enumerator
NVSURF_PERSPECTIVE 

Perspective, projective, rectilinear.

NVSURF_FISHEYE 

Fisheye, equidistant.

NVSURF_EQUIRECT 

Equirectangular spherical.

NVSURF_CYLINDER 

Cylindrical, panned horizontally with vertical axis.

NVSURF_ROTCYLINDER 

Cylindrical, panned vertically, with horizontal axis.

NVSURF_PUSHBROOM 

Simulated pushbroom. Control[0] typically in (0, 1].

NVSURF_PANINI 

Panini. Control[0] typically in (0, 1].

NVSURF_STEREOGRAPHIC 

Generalized Stereographic. Normal stereographic has control[0] = 1.

NVSURF_BITS 

The width of the field used for each image type.

NVSURF_UNKNOWN 

Unknown (currently 255).

NVSURF_MASK 

The NVWARP_360 mask (currently 0xFF).

NVSURF_MAX 

This makes it 32 bits.

Definition at line 64 of file NVWarp360.h.

◆ nvwarpType_t

Warp type enumeration.

Enumerator
NVWARP_EQUIRECT_CYLINDER 

Equirectangular to cylindrical.

NVWARP_EQUIRECT_EQUIRECT 

Equirectangular to equirectangular.

NVWARP_EQUIRECT_FISHEYE 

Equirectangular to fisheye.

NVWARP_EQUIRECT_PANINI 

Equirectangular to Panini.

NVWARP_EQUIRECT_PERSPECTIVE 

Equirectangular to perspective.

NVWARP_EQUIRECT_PUSHBROOM 

Equirectangular to pushbroom.

NVWARP_EQUIRECT_STEREOGRAPHIC 

Equirectangular to generalized stereographic.

NVWARP_EQUIRECT_ROTCYLINDER 

Equirectangular to vertical cylindrical.

NVWARP_FISHEYE_CYLINDER 

Fisheye to horizontally panned cylinder.

NVWARP_FISHEYE_EQUIRECT 

Fisheye to equirectangular.

NVWARP_FISHEYE_FISHEYE 

Fisheye to fisheye.

NVWARP_FISHEYE_PANINI 

Fisheye to Panini.

NVWARP_FISHEYE_PERSPECTIVE 

Fisheye to perspective.

NVWARP_FISHEYE_PUSHBROOM 

Fisheye to pushbroom.

NVWARP_FISHEYE_ROTCYLINDER 

Fisheye to vertically panned radial cylinder.

NVWARP_PERSPECTIVE_EQUIRECT 

Perspective to equirectangular.

NVWARP_PERSPECTIVE_PANINI 

Perspective to Panini.

NVWARP_PERSPECTIVE_PERSPECTIVE 

Perspective to perspective.

NVWARP_NONE 

This makes it 32 bits.

Definition at line 82 of file NVWarp360.h.

Function Documentation

◆ nvwarpComputeBoxAxialAngleRange()

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];

Parameters
[in]paramsthe Warp360 parameters.
[in]srcBoundingBoxan array of length 4 for describing bounding box in source image {leftTopX, leftTopY, bottomRightX, bottomRightY}.
[out]minMaxXYan array of length 4, where the values {minX, maxX, minY, maxY} angles, in radians, are returned.
Returns
true if successful; otherwise false.
Note
At the moment, only fisheye, perspective and equirectangular sources are accommodated.
Even though this guarantees that this angular range contains valid pixels along the horizontal and vertical axes through the center of projection, this does not guarantee that the same holds true at the corners.

◆ nvwarpComputeDstAngularFromPixelCoordinates()

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.

Parameters
[in]hanthe Warp360 instance.
[in]numPtsthe number of points to be converted into rays.
[in]pts2Dthe array of 2D points to be transformed into 3D rays.
[out]ang2Dthe array into which the 2D angles are to be placed. NANs are returned for unsuccessful conversions.
Returns
NVWARP_SUCCESS, if the conversion was successful,
NVWARP_ERR_DOMAIN if it fails due to any coordinate being out of domain.
NVWARP_ERR_UNIMPLEMENTED if it is an unsupported warp type.

◆ nvwarpComputeDstFocalLength()

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.

Parameters
[in,out]hanthe Warp360 instance.
[in]topAnglethe top view angle.
[in]bottomAnglethe bottom view angle.
[in]dstWidththe width of the destination.
[in]dstHeightthe height of the destination.
Note
If (topAngle < bottomAngle), a negative focal length will result, and is not recommended.

◆ nvwarpComputeDstFocalLengths()

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.

Parameters
[in,out]hanthe Warp360 instance.
[in]topAxialAnglethe top view angle through the center of projection.
[in]botAxialAnglethe bottom view angle through the center of projection.
[in]leftAxialAnglethe left view angle through the center of projection.
[in]rightAxialAnglethe right view angle through the center of projection.
[in]dstWidththe width of the destination.
[in]dstHeightthe height of the destination.
Note
If (topAngle < bottomAngle), a negative focal length will result, and is not recommended.

◆ nvwarpComputeDstPixelFromAngularCoordinates()

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.

Parameters
[in]hanthe Warp360 instance.
[in]numPtsthe number of angle pairs to be converted into 2D points.
[in]ang2Dthe array of 2D angles to be converted into 2D points.
[out]pts2Dthe array into which the 2D points are to be placed. NANs are returned for unsuccessful conversions.
Returns
NVWARP_SUCCESS, if the conversion was successful,
NVWARP_ERR_DOMAIN if it fails due to any coordinate being out of domain.
NVWARP_ERR_UNIMPLEMENTED if it is an unsupported warp type.

◆ nvwarpComputeParamsAxialAngleRange()

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];

Parameters
[in]paramsthe Warp360 parameters.
[out]minMaxXYan array of length 4, where the values {minX, maxX, minY, maxY} angles, in radians, are returned.
Returns
true if successful; otherwise false.
Note
At the moment, only fisheye, perspective and equirectangular sources are accommodated.
Even though this guarantees that this angular range contains valid pixels along the horizontal and vertical axes through the center of projection, this does not guarantee that the same holds true at the corners.

◆ nvwarpComputeParamsOutputResolution()

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.

Parameters
[in,out]paramsthe Warp360 parameters.
[in]aspectRatiothe ratio of width/height for the output.
Returns
true if the dstWidth and dstHeight were updated successfully, false if not.
Note
This API provides a suggestion that should be tweaked to meet the needs of the application. Enlarging the dimensions will produce a bigger image, but not introduce any new details. Reducing the dimensions will not only produce a smaller image, but will lose more details as it shrinks. It is not recommended to reduce these dimensions smaller than 1/3, or aliasing will be introduced.

◆ nvwarpComputeParamsSrcFocalLength()

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.

Parameters
[in,out]paramsthe Warp360 parameters to be set.
[in]anglethe angle in radians.
[in]radiusthe radius, in pixels, corresponding to the angle above.
Returns
true if the srcFocalLen was computed successfully, false otherwise.
Note
The focal length is one of the properties of the source, and this API provides a way to convert angle and distortion measurements into a focal length. Once calibrated for a given lens and camera, it is fixed, and not considered to be a warp control parameter.
The focal length can also be acquired from the image EXIF data without the use of this API. In particular, the focalLength tag (37386) yields the focal length in millimeters. Then the FocalPlaneXResolution tag (41486), the FocalPlaneXResolution tag (41487), and FocalPlaneResolutionUnit tag (41488) can be used to compute the X and Y focal lengths by converting mm to pixels. If the X and Y focal lengths differ, it is suggested to use the geometric average focLen = sqrt(focLenX * focLenY).

◆ nvwarpComputeSrcAngularFromPixelCoordinates()

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.

Parameters
[in]hanthe Warp360 instance.
[in]numPtsthe number of 2D points to be converted into angles.
[in]pts2Dthe array of 2D points to be transformed into 2D angles.
[out]ang2Dthe array into which the 2D angles are to be placed. NANs are returned for unsuccessful conversions.
Returns
NVWARP_SUCCESS, if the conversion was successful,
NVWARP_ERR_DOMAIN if it fails due to any coordinate being out of domain.
NVWARP_ERR_UNIMPLEMENTED if it is an unsupported warp type.

◆ nvwarpComputeSrcFocalLength()

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

Parameters
[in,out]hanthe Warp360 instance.
[in]warpTypethe warp type.
[in]radiusa radius, i.e. distance from the principal point, e.g. to an edge.
[in]anglethe angle corresponding to the above radius, i.e. angular distance from the optical axis.
[in]distthe distortion coefficients. (NULL implies (0,0,0,0,0).
Note
The focal length is one of the properties of the source, and this API provides a way to convert angle and distortion measurements into a focal length. Once calibrated for a given lens and camera, it is fixed, and not considered to be a warp control parameter.
The focal length can also be acquired from the image EXIF data without the use of this API. In particular, the focalLength tag (37386) yields the focal length in millimeters. Then the FocalPlaneXResolution tag (41486), the FocalPlaneXResolution tag (41487), and FocalPlaneResolutionUnit tag (41488) can be used to compute the X and Y focal lengths by converting mm to pixels. If the X and Y focal lengths differ, it is suggested to use the geometric average focLen = sqrt(focLenX * focLenY).

◆ nvwarpComputeSrcPixelFromAngularCoordinates()

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.

Parameters
[in]hanthe Warp360 instance.
[in]numPtsthe number of angle pairs to be converted into 2D points.
[in]ang2Dthe array of 2D angles to be converted into 2D points.
[out]pts2Dthe array into which the 2D points are to be placed. NANs are returned for unsuccessful conversions.
Returns
NVWARP_SUCCESS, if the conversion was successful,
NVWARP_ERR_DOMAIN if it fails due to any coordinate being out of domain.
NVWARP_ERR_UNIMPLEMENTED if it is an unsupported warp type.

◆ nvwarpComputeYCbCr2RgbMatrix()

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}.

Parameters
[out]pthe location of the parameters that will be set by this method.
[in]matrix_coefficientsOne 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_flag0 for standard video range (16-240), 1 for full range (0-255).
[in]bit_depth8 is the only depth that is supported by nvwarpConvertYUVNV12ToRGBA().
[in]normalized_input1 if the input is normalized, 0 if not.
[in]normalized_output1 if the output is normalized, 0 if not.

◆ nvwarpConvertTransformBetweenYUpandYDown()

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}.

Parameters
[in]frthe initial transformation to be converted.
[out]toa place to store the converted transformation (can the same as fr).

◆ nvwarpConvertYUVNV12ToRGBA()

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.

Parameters
[in]streamThe stream on which the computation is to be performed.
[in]paramsThe parameters controlling the YUV-->RGB conversion; typically set with YUVRGBParams.computeMatrix().
[in]yuvPointer to the YV CUDA pitched memory buffer.
[in]yuvRowBytesByte stride between pixels vertically in the luminance (and chrominance) of YUV.
[in]dstPointer to the RGBA CUDA pitched memory buffer.
[in]dstRowBytesByte stride between pixels vertically in the RGBA.
Returns
NVWARP_SUCCESS if successful.

◆ nvwarpCreateInstance()

nvwarpResult NVWARPAPI nvwarpCreateInstance ( nvwarpHandle han)

Constructor for a new instance of a Warp360 object.

Parameters
[out]hana place to store the new instance of Warp360 object.
Returns
NVWARP_SUCCESS if successful.

◆ nvwarpDestroyInstance()

void NVWARPAPI nvwarpDestroyInstance ( nvwarpHandle  han)

Destructor for a Warp360 object.

Parameters
[in]hanhandle to a Warp360 object. Can be NULL.

◆ nvwarpDstFromRay()

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.

Parameters
[in]hanthe Warp360 instance.
[in]numRaysthe number of rays to be converted into points.
[in]rays3Dthe array of 3D rays to be transformed into 2D points.
[out]pts2Dthe array into which the 2D points are to be placed. NANs are returned for unsuccessful conversions.
Returns
NVWARP_SUCCESS, if the conversion was successful,
NVWARP_ERR_DOMAIN if it fails due to being out of domain.
NVWARP_ERR_UNIMPLEMENTED if it is an unsupported warp type.

◆ nvwarpDstToRay()

nvwarpResult NVWARPAPI nvwarpDstToRay ( const nvwarpHandle  han,
uint32_t  numPts,
const float *  pts2D,
float *  rays3D 
)

Convert destination coordinates into normalized rays.

Parameters
[in]hanthe Warp360 instance.
[in]numPtsthe number of points to be converted into rays.
[in]pts2Dthe array of 2D points to be transformed into 3D rays.
[out]rays3Dthe array into which the 3D rays are to be placed. NANs are returned for unsuccessful conversions.
Returns
NVWARP_SUCCESS, if the conversion was successful,
NVWARP_ERR_DOMAIN if it fails due to any coordinate being out of domain.
NVWARP_ERR_UNIMPLEMENTED if it is an unsupported warp type.

◆ nvwarpErrorStringFromCode()

const char* NVWARPAPI nvwarpErrorStringFromCode ( nvwarpResult  err)

Get the error string corresponding to the given result code.

Parameters
[in]errthe error code.
Returns
the C-string corresponding to the given error code.

◆ nvwarpGetBlock()

void NVWARPAPI nvwarpGetBlock ( const nvwarpHandle  han,
dim3 *  dim_block 
)

Get the current value of the CUDA block size.

Parameters
[in]hanthe Warp360 instance.
[out]dim_blockpointer to a location where the block size is to be stored.

◆ nvwarpGetControl()

float NVWARPAPI nvwarpGetControl ( const nvwarpHandle  han,
uint32_t  index 
)

Get the value for the control parameters.

Parameters
[in]hanthe Warp360 instance.
[in]indexthe index of the control parameter to retrieve.
Returns
the value of the specified control parameter, or NaN if there is no such parameter (i.e. index > 0 at the moment).
Note
Only control[0] is implemented, but only for a few warps.

◆ nvwarpGetDistortion()

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.

Parameters
[in]hanthe Warp360 instance.
[out]dthe array where the distortion coefficients are to be stored.

◆ nvwarpGetDstFocalLength()

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.

Parameters
[in]hanthe Warp360 instance.
[out]fya place to store the Y focal length (can be NULL if it is not desired).
Returns
the destination focal length.

◆ nvwarpGetDstPrincipalPoint()

void NVWARPAPI nvwarpGetDstPrincipalPoint ( const nvwarpHandle  han,
float  xy[2],
uint32_t  relToCenter 
)

Get the destination principal point.

Parameters
[in]hanthe Warp360 instance.
[out]xya place to store the destination principal point.
[in]relToCenter0 = relative to the upper left corner of the image, 1 = relative to the center of the image.

◆ nvwarpGetDstWidthHeight()

void NVWARPAPI nvwarpGetDstWidthHeight ( const nvwarpHandle  han,
uint32_t  wh[2] 
)

Get the destination width and height.

Parameters
[in]hanthe Warp360 instance.
[out]whan array in which to store the width and height.

◆ nvwarpGetParams()

void NVWARPAPI nvwarpGetParams ( const nvwarpHandle  han,
nvwarpParams_t params 
)

Get the current values of the warp parameters.

Parameters
[in]hanthe Warp360 instance.
[out]paramspointer to the location where the parameters are to be stored.
Note
An equivalent series of rotation angles and axes may be returned instead of the one supplied; it still results in the same rotation. In particular, "YXZ", "ZXY" and "ZXZ" are returned as given, and all else are returned as "YXZ".

◆ nvwarpGetPixelPhase()

uint32_t NVWARPAPI nvwarpGetPixelPhase ( const nvwarpHandle  han)

Get the pixel phase.

Parameters
[in]hanthe Warp360 instance.
Returns
0 if pixels are sampled on the integers (default), 1 if pixels are sampled on the integers-plus-one-half.

◆ nvwarpGetRotation()

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.

Parameters
[in]hanthe Warp360 instance.
[out]Ra place to store the current rotation matrix.

◆ nvwarpGetSrcFocalLength()

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.

Parameters
[in]hanthe Warp360 instance.
[out]fya place to store the Y focal length. (can be NULL if only one focal length is desired).
Returns
the X source focal length.

◆ nvwarpGetSrcPrincipalPoint()

void NVWARPAPI nvwarpGetSrcPrincipalPoint ( const nvwarpHandle  han,
float  xy[2],
uint32_t  relToCenter 
)

Get the source principal point.

Parameters
[in]hanthe Warp360 instance.
[out]xya place to store the source principal point.
[in]relToCenterzero = relative to the upper left corner of the image, nonzero = relative to the center of the image.

◆ nvwarpGetSrcRadius()

float NVWARPAPI nvwarpGetSrcRadius ( const nvwarpHandle  han)

Get the source fisheye clipping radius.

Parameters
[in]hanthe Warp360 instance.
Returns
the fisheye clipping radius. Zero indicates no circular clipping.

◆ nvwarpGetSrcWidthHeight()

void NVWARPAPI nvwarpGetSrcWidthHeight ( const nvwarpHandle  han,
uint32_t  wh[2] 
)

Get the source image dimensions.

Parameters
[in]hanthe Warp360 instance.
[out]wha place to store the source width (wh[0]) and height (wh[1]).

◆ nvwarpGetUserData()

void* NVWARPAPI nvwarpGetUserData ( nvwarpHandle  han)

Get the current value of the user data pointer.

Parameters
[in]hanthe Warp360 instance.
Returns
the current value of the user data pointer.

◆ nvwarpGetWarpType()

nvwarpType_t NVWARPAPI nvwarpGetWarpType ( const nvwarpHandle  han)

Get the type of the warp.

Parameters
[in]hanthe Warp360 instance.
Returns
the type of the warp.

◆ nvwarpInitParams()

void NVWARPAPI nvwarpInitParams ( nvwarpParams_t params)

Initialize nvwarpParams_t to defaults or NaN if a particular parameter must be supplied.

Parameters
[out]paramsthe parameter block to initialize.

◆ nvwarpInverseWarpCoordinates()

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.

Parameters
[in]hanthe Warp360 instance.
[in]numPtsthe number of points to be transformed.
[in]inPtsXYan array of 2D points to be transformed.
[out]outPtsXYa 2D point array of where the transformed 2D points are to be placed. This can be the same as inPtsXY.
Returns
NVWARP_SUCCESS, if the conversion was successful,
NVWARP_ERR_DOMAIN if it fails due to any coordinate being out of domain.
NVWARP_ERR_UNIMPLEMENTED if it is an unsupported warp type.
Note
Tangential distortion is implemented for perspective.

◆ nvwarpMultiWarp360()

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.

Parameters
[in]streamStream on which to perform this computation.
[in]yuvParamsParameters for the YUV-->RGB conversion (can be NULL).
[in]yuvBufferThe buffer containing the YUV data in 420 NV12 format.
[in]yuvRowBytesThe byte stride between luminance (and chroma) pixels vertically.
[in]rgbBufferThe buffer where the YUV-->RGB conversion is to be placed.
[in]rgbRowBytesThe byte stride between RGBA pixels vertically.
[in]rgbTexThe texture associated with the RGB buffer, initialized appropriately.
[in]numWarpsThe number of warps to be executed on using the RGB buffer texture as a source.
[in]paramArrayThe array of parameter blocks for each warp.
[out]dstBuffersThe array of pointers to the destination buffers.
[in]dstRowBytesThe array of byte strides between pixels vertically, one for each warp.
Returns
NVWARP_SUCCESS if successful.

◆ nvwarpSetBlock()

void NVWARPAPI nvwarpSetBlock ( nvwarpHandle  han,
dim3  dim_block 
)

Set the CUDA block size.

Parameters
[in,out]hanthe Warp360 instance.
[in]dim_blockthe desired block size (default 8x8).

◆ nvwarpSetControl()

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.

Parameters
[in,out]hanthe Warp360 instance.
[in]indexthe index of the control to be set.
[in]controlthe desired control value.
Note
If a particular warp does not use a control parameter, it is ignored.

◆ nvwarpSetDistortion()

void NVWARPAPI nvwarpSetDistortion ( nvwarpHandle  han,
const float  d[5] 
)

Set the distortion coefficients.

Parameters
[in,out]hanthe Warp360 instance.
[in]dthe 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.

◆ nvwarpSetDstFocalLengths()

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.

Parameters
[in,out]hanthe Warp360 instance.
[in]flthe desired X focal length.
[in]fythe desired Y focal length. If zero, it is set to be identical to the X focal length.
Note
Negative focal lengths have the effect of reflection, but are not recommended.

◆ nvwarpSetDstPrincipalPoint()

void NVWARPAPI nvwarpSetDstPrincipalPoint ( nvwarpHandle  han,
const float  xy[2],
uint32_t  relToCenter 
)

Set the destination principal point.

Parameters
[in,out]hanthe Warp360 instance.
[in]xythe principal point. NULL implies (0,0).
[in]relToCenterzero = 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.
Note
The Y axis is always considered to point downward.
The destination width and height must be specified prior to calling nvwarpSetDstPrincipalPoint().
A good default is nvwarpSetDstPrincipalPoint(han, NULL, 1);

◆ nvwarpSetDstWidthHeight()

void NVWARPAPI nvwarpSetDstWidthHeight ( nvwarpHandle  han,
uint32_t  w,
uint32_t  h 
)

Set the destination width and height.

Parameters
[in,out]hanthe Warp360 instance.
[in]wthe desired destination width.
[in]hthe desired destination height.

◆ nvwarpSetEulerRotation()

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.

Parameters
[in,out]hanthe Warp360 instance.
[in]anglesa list of angles, typically 3 for traditional Euler angles, but can be any size greater than 0.
[in]axesthe 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.

◆ nvwarpSetParams()

nvwarpResult NVWARPAPI nvwarpSetParams ( nvwarpHandle  han,
const nvwarpParams_t params 
)

Set parameters for a warp.

Parameters
[out]hanthe Warp360 instance.
[in]paramspointer to the desired parameters for the warp. NULL initializes the parameters to NaN or default values as appropriate.
Returns
NVWARP_SUCCESS if successful.

◆ nvwarpSetPixelPhase()

void NVWARPAPI nvwarpSetPixelPhase ( nvwarpHandle  han,
uint32_t  phase 
)

Set the pixel phase.

Parameters
[in,out]hanthe Warp360 instance.
[in]phasezero = 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].

◆ nvwarpSetRotation()

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.

Parameters
[in,out]hanthe Warp360 instance.
[in]Rthe rotation transformation. This should be an orthonormal transformation, but is not enforced. NULL implies identity.

◆ nvwarpSetSrcFocalLengths()

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.

Parameters
[in,out]hanthe Warp360 instance.
[in]flthe X focal length.
[in]fythe Y focal length; if zero, the X focal length is used for Y as well.
Note
Negative focal lengths will cause reflection, but are not recommended.

◆ nvwarpSetSrcPrincipalPoint()

void NVWARPAPI nvwarpSetSrcPrincipalPoint ( nvwarpHandle  han,
const float  xy[2],
uint32_t  relToCenter 
)

Specify the principal point of the source image.

Parameters
[in,out]hanthe Warp360 instance.
[in]xythe principal point. NULL implies (0,0).
[in]relToCenterzero = 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.
Note
The Y axis is always considered to point downward.
The source width and height must be specified prior to calling nvwarpSetSrcPrincipalPoint().
A good default is nvwarpSetDstPrincipalPoint(han, NULL, 1);

◆ nvwarpSetSrcRadius()

void NVWARPAPI nvwarpSetSrcRadius ( nvwarpHandle  han,
float  r 
)

set the source fisheye clipping radius.

Parameters
[in,out]hanthe Warp360 instance.
[in]rthe fisheye clipping radius. No clipping is specified by r<=0.
Note
this is not [yet] used for circular clipping.

◆ nvwarpSetSrcWidthHeight()

void NVWARPAPI nvwarpSetSrcWidthHeight ( nvwarpHandle  han,
uint32_t  w,
uint32_t  h 
)

Set the source dimensions.

Parameters
[in,out]hanthe Warp360 instance.
[in]wthe source width, in pixels.
[in]hthe source height, in pixels.

◆ nvwarpSetUserData()

void NVWARPAPI nvwarpSetUserData ( nvwarpHandle  han,
void *  userData 
)

Set the user data pointer.

Parameters
[in,out]hanthe Warp360 instance.
[in]userDatapointer to the user data.

◆ nvwarpSetWarpType()

nvwarpResult NVWARPAPI nvwarpSetWarpType ( nvwarpHandle  han,
nvwarpType_t  type 
)

Set the warp type.

Parameters
[in,out]hanthe Warp360 instance.
[in]typethe warp type.
Returns
NVWARP_SUCCESS if successful,
NVWARP_ERR_UNIMPLEMENTED if the specified warp type is unimplemented or unknown.

◆ nvwarpSrcFromRay()

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.

Parameters
[in]hanthe Warp360 instance.
[in]numRaysthe number of rays to be converted into points.
[in]rays3Dthe array of 3D rays to be transformed into 2D points.
[out]pts2Dthe array into which the 2D points are to be placed. NANs are returned for unsuccessful conversions.
Returns
NVWARP_SUCCESS, if the conversion was successful,
NVWARP_ERR_DOMAIN if it fails due to being out of domain.
NVWARP_ERR_UNIMPLEMENTED if it is an unsupported warp type.

◆ nvwarpSrcToRay()

nvwarpResult NVWARPAPI nvwarpSrcToRay ( const nvwarpHandle  han,
uint32_t  numPts,
const float *  pts2D,
float *  rays3D 
)

Convert source coordinates into normalized rays.

Parameters
[in]hanthe Warp360 instance.
[in]numPtsthe number of points to be converted into rays.
[in]pts2Dthe array of 2D points to be transformed into 3D rays.
[out]rays3Dthe array into which the 3D rays are to be placed. NANs are returned for unsuccessful conversions.
Returns
NVWARP_SUCCESS, if the conversion was successful,
NVWARP_ERR_DOMAIN if it fails due to being out of domain.
NVWARP_ERR_APPROXIMATE if tangential distortion is used for a perspective source, due to lack of implementation; only the radial distortion is accommodated.
NVWARP_ERR_UNIMPLEMENTED if it is an unsupported warp type.
Note
The nvwarpSrcToRay(), nvwarpDstToRay(), nvwarpSrcFromRay() and nvwarpDstFromRay() functions can be used to warp coordinates as follows:
float srcPt[2], dstPt[2], srcRay[3], dstRay[3], M[9];
...
nvwarpGetRotation(warper, M);
nvwarpSrcToRay(warper, 1, srcPt, srcRay); // Warp
dstRay[0] = M[0] * srcRay[0] + M[1] * srcRay[1] + M[2] * srcRay[2];
dstRay[1] = M[3] * srcRay[0] + M[4] * srcRay[1] + M[5] * srcRay[2];
dstRay[2] = M[6] * srcRay[0] + M[7] * srcRay[1] + M[8] * srcRay[2];
nvwarpDstFromRay(warper, 1, dstRay, dstPt);
...
nvwarpDstToRay(warper, 1, dstPt, dstRay); // Inverse Warp
srcRay[0] = M[0] * dstRay[0] + M[3] * dstRay[1] + M[6] * dstRay[2];
srcRay[1] = M[1] * dstRay[0] + M[4] * dstRay[1] + M[7] * dstRay[2];
srcRay[2] = M[2] * dstRay[0] + M[5] * dstRay[1] + M[8] * dstRay[2];
nvwarpSrcFromRay(warper, 1, srcRay, srcPt);

◆ nvwarpVersion()

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.

Returns
the version number.

◆ nvwarpWarpBuffer()

nvwarpResult NVWARPAPI nvwarpWarpBuffer ( const nvwarpHandle  han,
cudaStream_t  stream,
cudaTextureObject_t  srcTex,
void *  dstAddr,
size_t  dstRowBytes 
)

Warp an image texture to a buffer.

Parameters
[in]hanthe Warp360 instance.
[in]streamthe stream on which to execute the warp.
[in]srcTexthe source texture.
[out]dstAddrthe destination buffer address.
[in]dstRowBytesthe byte stride between pixels in the buffer vertically.
Returns
NVWARP_SUCCESS if successful.

◆ nvwarpWarpCoordinates()

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.

Parameters
[in]hanthe Warp360 instance.
[in]numPtsthe number of points to be transformed.
[in]inPtsXYan array of 2D points to be transformed.
[out]outPtsXYa 2D point array of where the transformed 2D points are to be placed. This can be the same as inPtsXY.
Returns
NVWARP_SUCCESS, if the conversion was successful,
NVWARP_ERR_DOMAIN if it fails due to any coordinate being out of domain.
NVWARP_ERR_APPROXIMATE if tangential distortion is used for a perspective source, due to lack of implementation; only the radial distortion is accommodated.
NVWARP_ERR_UNIMPLEMENTED if it is an unsupported warp type.

◆ nvwarpWarpSurface()

nvwarpResult NVWARPAPI nvwarpWarpSurface ( const nvwarpHandle  han,
cudaStream_t  stream,
cudaTextureObject_t  srcTex,
cudaSurfaceObject_t  dstSurface 
)

Warp an image texture to a surface.

Parameters
[in]hanthe Warp360 instance.
[in]streamthe stream on which to execute the warp.
[in]srcTexthe source texture.
[out]dstSurfacethe destination surface.
Returns
NVWARP_SUCCESS if successful.
nvwarpSrcToRay
nvwarpResult NVWARPAPI nvwarpSrcToRay(const nvwarpHandle han, uint32_t numPts, const float *pts2D, float *rays3D)
Convert source coordinates into normalized rays.
nvwarpSrcFromRay
nvwarpResult NVWARPAPI nvwarpSrcFromRay(const nvwarpHandle han, uint32_t numRays, const float *rays3D, float *pts2D)
Convert rays into source coordinates.
nvwarpDstFromRay
nvwarpResult NVWARPAPI nvwarpDstFromRay(const nvwarpHandle han, uint32_t numRays, const float *rays3D, float *pts2D)
Convert rays into destination coordinates.