NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release

Detailed Description

The 2D LDC (lens distortion correction) Utility Functions API offers a set of utility functions for working with LDC warp maps.

Data Structures

struct  NvMedia2DLdcCameraIntrinsic
 Instrinsic camera parameters. More...
 
struct  NvMedia2DLdcCameraExtrinsic
 Extrinsic camera parameters. More...
 
struct  NvMedia2DLdcLensDistortion
 Distortion coefficients for the lens model. More...
 

Enumerations

enum  NvMedia2DLdcLensModel {
  NVMEDIA_2D_LDC_LENS_MODEL_POLYNOMIAL_DISTORTION,
  NVMEDIA_2D_LDC_LENS_MODEL_FISHEYE_EQUIDISTANT,
  NVMEDIA_2D_LDC_LENS_MODEL_FISHEYE_EQUISOLID,
  NVMEDIA_2D_LDC_LENS_MODEL_FISHEYE_ORTHOGRAPHIC,
  NVMEDIA_2D_LDC_LENS_MODEL_FISHEYE_STEREOGRAPHIC
}
 Supported lens models used to generate a Warp Map. More...
 

Functions

NvMediaStatus NvMedia2DGetNumLdcControlPoints (NvMedia2DLdcRegionParameters const *const regionParams, uint32_t *numControlPoints)
 Helper function to calculate the number of control points from the defined sparse warp map region parameters. More...
 
NvMediaStatus NvMedia2DGenLdcWarpMapIdentity (NvMediaRect const *const dstRect, NvMedia2DLdcRegionParameters const *const regionParams, uint32_t numControlPoints, NvMedia2DLdcControlPoint *const controlPoints)
 Helper function to fills the given warp map with an identity mapping. More...
 
NvMediaStatus NvMedia2DGenLdcWarpMap (NvMedia2DLdcCameraIntrinsic const *const Kin, NvMedia2DLdcCameraExtrinsic const *const X, NvMedia2DLdcCameraIntrinsic const *const Kout, NvMedia2DLdcLensDistortion const *const distModel, NvMediaRect const *const dstRect, NvMedia2DLdcRegionParameters const *const regionParams, uint32_t numControlPoints, NvMedia2DLdcControlPoint *const controlPoints)
 Generates Warp Map for a particular lens model. More...
 

Enumeration Type Documentation

◆ NvMedia2DLdcLensModel

Supported lens models used to generate a Warp Map.


Usage considerations

  • Maturity: GA
See also
NvMedia2DLdcGenWarpMap
Enumerator
NVMEDIA_2D_LDC_LENS_MODEL_POLYNOMIAL_DISTORTION 

Specifies a polynomial distortion model.

NVMEDIA_2D_LDC_LENS_MODEL_FISHEYE_EQUIDISTANT 

Specifies a fisheye model: r = f*theta, where theta is the angle from the optical axis, f is the focal length, and r is the distance of a pixel from the image center.

NVMEDIA_2D_LDC_LENS_MODEL_FISHEYE_EQUISOLID 

Specifies a fisheye model: r = 2*f*sin(theta/2), where theta is the angle from the optical axis, f is the focal length, and r is the distance of a pixel from the image center.

NVMEDIA_2D_LDC_LENS_MODEL_FISHEYE_ORTHOGRAPHIC 

Specifies a fisheye model: r = f*sin(theta), where theta is the angle from the optical axis, f is the focal length, and r is the distance of a pixel from the image center.

NVMEDIA_2D_LDC_LENS_MODEL_FISHEYE_STEREOGRAPHIC 

Specifies a fisheye model: r = 2*f*tan(theta/2), where theta is the angle from the optical axis, f is the focal length, and r is the distance of a pixel from the image center.

Definition at line 43 of file nvmedia_2d_ldcutil.h.

Function Documentation

◆ NvMedia2DGenLdcWarpMap()

NvMediaStatus NvMedia2DGenLdcWarpMap ( NvMedia2DLdcCameraIntrinsic const *const  Kin,
NvMedia2DLdcCameraExtrinsic const *const  X,
NvMedia2DLdcCameraIntrinsic const *const  Kout,
NvMedia2DLdcLensDistortion const *const  distModel,
NvMediaRect const *const  dstRect,
NvMedia2DLdcRegionParameters const *const  regionParams,
uint32_t  numControlPoints,
NvMedia2DLdcControlPoint *const  controlPoints 
)

Generates Warp Map for a particular lens model.

The result is valid only on the same HW platform where this function was called.

Parameters
[in]KinPointer to NvMedia2DLdcCameraIntrinsic parameters.
[in]XPointer to NvMedia2DLdcCameraExtrinsic parameters.
[in]KoutPointer to NvMedia2DLdcCameraIntrinsic parameters.
[in]distModelPointer to NvMedia2DLdcLensDistortion struct.
[in]dstRectPointer to the destination rectangle.
[in]regionParamsPointer to NvMedia2DLdcRegionParameters for Warp Map.
[in]numControlPointsNumber of control points in Warp Map.
[in]controlPointsPointer to the control points array.
Returns
An NvMediaStatus return code.
Return values
NVMEDIA_STATUS_OKWarp Map is successfully generated.
NVMEDIA_STATUS_BAD_PARAMETEROne of parameters is invalid. This could be either:
  • Kin is NULL
  • X is NULL
  • Kout is NULL
  • distModel is NULL
  • dstRect is NULL
  • regionParams is NULL
  • numControlPoints is 0
  • controlPoints is NULL
  • regionParams has values that out of acceptable domain.
  • number of control points is inconsistent with regions config.
  • X is invalid, determinant is 0.
NVMEDIA_STATUS_NOT_SUPPORTEDCurrent HW platform is not supported.
NVMEDIA_STATUS_ERRORAn internal failure occurred.
Precondition
None.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes, with the following conditions:
      • Each thread uses different controlPoints object
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvMedia2DGenLdcWarpMapIdentity()

NvMediaStatus NvMedia2DGenLdcWarpMapIdentity ( NvMediaRect const *const  dstRect,
NvMedia2DLdcRegionParameters const *const  regionParams,
uint32_t  numControlPoints,
NvMedia2DLdcControlPoint *const  controlPoints 
)

Helper function to fills the given warp map with an identity mapping.

This function is useful if the user wants to specify their own mapping. It sets the control points coordinates to the destination coordinates as defined implicitly by the NvMedia2DLdcRegionParameters. The user then can iterate through these points and apply a custom mapping function to each one.

The result is valid only on the same HW platform where this function was called.

Parameters
[in]dstRectPointer to the destination rectangle.
[in]regionParamsPointer to NvMedia2DLdcRegionParameters for Warp Map.
[in]numControlPointsNumber of control points in Warp Map.
[in]controlPointsPointer to the control points array.
Returns
An NvMediaStatus return code.
Return values
NVMEDIA_STATUS_OKWarp Map was successfully configured.
NVMEDIA_STATUS_BAD_PARAMETEROne of parameters is invalid. This could be either:
  • dstRect is NULL
  • regionParams is NULL
  • numControlPoints is 0
  • controlPoints is NULL
  • regionParams has values that out of acceptable domain.
  • number of control points is inconsistent with regions config.
NVMEDIA_STATUS_NOT_SUPPORTEDCurrent HW platform is not supported.
NVMEDIA_STATUS_ERRORAn internal failure occurred.
Precondition
None.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes, with the following conditions:
      • Each thread uses different controlPoints object
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvMedia2DGetNumLdcControlPoints()

NvMediaStatus NvMedia2DGetNumLdcControlPoints ( NvMedia2DLdcRegionParameters const *const  regionParams,
uint32_t *  numControlPoints 
)

Helper function to calculate the number of control points from the defined sparse warp map region parameters.

The result is valid only on the same HW platform where this function was called.

Parameters
[in]regionParamsPointer to NvMedia2DLdcRegionParameters that contains parameters for regions of a Warp Map.
[out]numControlPointsNumber of Control Points calculated.
Returns
An NvMediaStatus return code.
Return values
NVMEDIA_STATUS_OKNumber of Control Points has been calculated successfully.
NVMEDIA_STATUS_BAD_PARAMETEROne of parameters is invalid. This could be either:
  • regionParams is NULL
  • numControlPoints is NULL
  • regionParams has values that out of acceptable domain.
NVMEDIA_STATUS_NOT_SUPPORTEDCurrent HW platform is not supported.
NVMEDIA_STATUS_ERRORAn internal failure occurred.
Precondition
None.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes, with the following conditions:
      • Each thread uses different numControlPoints object
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA