|
|
NVIDIA DeepStream SDK API Reference
|
9.2 Release
|
Go to the documentation of this file.
24 #include <cuda_runtime.h>
25 #include "NVWarp360.h"
115 bool computeSrcFocalLength(
float angle,
float radius);
125 bool computeAxialAngleRange(
float minMaxXY[4])
const;
136 bool computeAxialAngleRange(
const float srcBoundingBox[4],
float minMaxXY[4])
const;
146 bool computeOutputResolution(
float aspectRatio);
165 cudaError_t setParams(
const Warp360Params *params);
169 void getParams(Warp360Params *params)
const;
173 void setBlock(dim3 dim_block);
177 void getBlock(dim3 *dim_block)
const;
181 void* getUserData()
const;
188 cudaError_t warp(
cudaStream_t stream, cudaTextureObject_t srcTex, cudaSurfaceObject_t dstSurface)
const;
196 cudaError_t warp(
cudaStream_t stream, cudaTextureObject_t srcTex,
void *dstAddr,
size_t dstRowBytes)
const;
207 nvwarpResult warp(
unsigned numPts,
const float *inPtsXY,
float *outPtsXY)
const;
218 nvwarpResult inverseWarp(
unsigned numPts,
const float *inPtsXY,
float *outPtsXY)
const;
246 void setWarpType(Warp360Params::WarpType type);
252 void setPixelPhase(
int phase);
260 void setSrcFocalLength(
float fl,
float fy = 0.f);
265 void setSrcWidthHeight(
unsigned w,
unsigned h);
270 void setSrcRadius(
float r);
278 void setRotation(
const float R[9]);
288 void setEulerRotation(
const float *angles,
const char *axes);
295 void setSrcPrincipalPoint(
const float xy[2],
bool relToCenter);
301 void setDistortion(
const float d[5]);
306 void setDstWidthHeight(
unsigned w,
unsigned h);
313 void setDstPrincipalPoint(
const float xy[2],
bool relToCenter);
325 void setDstFocalLength(
float fl,
float fy = 0.f);
334 void setDstFocalLength(
float topAngle,
float bottomAngle,
unsigned dstWidth,
unsigned dstHeight);
340 void setControl(
unsigned index,
float control);
344 void setUserData(
void *userData);
348 Warp360Params::WarpType warpType()
const;
353 int pixelPhase()
const;
357 float srcFocalLength()
const;
361 void getSrcFocalLengths(
float fl[2])
const;
364 void getRotation(
float R[9])
const;
370 void getSrcPrincipalPoint(
float xy[2],
bool relToCenter)
const;
374 float srcRadius()
const;
378 void getSrcWidthHeight(
unsigned wh[2])
const;
383 void getDistortion(
float d[5])
const;
387 void getDstWidthHeight(
unsigned wh[2])
const;
393 void getDstPrincipalPoint(
float xy[2],
bool relToCenter)
const;
397 float dstFocalLength()
const;
401 void getDstFocalLengths(
float fl[2])
const;
407 float getControl(
unsigned index)
const;
434 nvwarpResult srcToRay(
unsigned numPts,
const float *pts2D,
float *rays3D)
const;
443 nvwarpResult dstToRay(
unsigned numPts,
const float *pts2D,
float *rays3D)
const;
452 nvwarpResult srcFromRay(
unsigned numRays,
const float *rays3D,
float *pts2D)
const;
461 nvwarpResult dstFromRay(
unsigned numRays,
const float *rays3D,
float *pts2D)
const;
469 static float* convertTransformBetweenYUpandYDown(
const float fr[9],
float to[9]);
474 struct nvwarpObject *_impl;
479 inline void Warp360::setBlock(dim3 dim_block) {
nvwarpSetBlock(_impl, dim_block); }
480 inline void Warp360::getBlock(dim3 *dim_block)
const {
nvwarpGetBlock(_impl, dim_block); }
482 inline Warp360Params::WarpType Warp360::warpType()
const {
return (Warp360Params::WarpType)
nvwarpGetWarpType(_impl); }
483 inline void Warp360::setPixelPhase(
int phase) {
nvwarpSetPixelPhase(_impl, (uint32_t)phase); }
492 inline void Warp360::setRotation(
const float R[9]) {
nvwarpSetRotation(_impl, R); }
493 inline void Warp360::getRotation(
float R[9])
const {
nvwarpGetRotation(_impl, R); }
494 inline void Warp360::setEulerRotation(
const float *angles,
const char *axes)
496 inline void Warp360::setSrcPrincipalPoint(
const float xy[2],
bool relToCenter)
498 inline void Warp360::getSrcPrincipalPoint(
float xy[2],
bool relToCenter)
504 inline void Warp360::setDstPrincipalPoint(
const float xy[2],
bool relToCenter)
506 inline void Warp360::getDstPrincipalPoint(
float xy[2],
bool relToCenter)
509 inline void Warp360::setDstFocalLength(
float topAngle,
float bottomAngle,
unsigned dstWidth,
unsigned dstHeight)
513 inline void Warp360::setControl(
unsigned index,
float control) {
nvwarpSetControl(_impl, index, control); }
514 inline float Warp360::getControl(
unsigned index)
const {
return nvwarpGetControl(_impl, index); }
515 inline void Warp360::setUserData(
void *userData) {
nvwarpSetUserData(_impl, userData); }
517 inline cudaError_t Warp360::warp(
cudaStream_t stream, cudaTextureObject_t srcTex, cudaSurfaceObject_t dstSurface)
const
519 inline cudaError_t Warp360::warp(
cudaStream_t stream, cudaTextureObject_t srcTex,
void *dstAddr,
size_t dstRowBytes)
const
520 {
return (cudaError_t)
nvwarpWarpBuffer(_impl, stream, srcTex, dstAddr, dstRowBytes); }
521 inline nvwarpResult Warp360::warp(
unsigned numPts,
const float *inPtsXY,
float *outPtsXY)
const
523 inline nvwarpResult Warp360::inverseWarp(
unsigned numPts,
const float *inPtsXY,
float *outPtsXY)
const
525 inline nvwarpResult Warp360::srcToRay(
unsigned numPts,
const float *pts2D,
float *rays3D)
527 inline nvwarpResult Warp360::dstToRay(
unsigned numPts,
const float *pts2D,
float *rays3D)
529 inline nvwarpResult Warp360::srcFromRay(
unsigned numRays,
const float *rays3D,
float *pts2D)
531 inline nvwarpResult Warp360::dstFromRay(
unsigned numRays,
const float *rays3D,
float *pts2D)
566 void computeMatrix(
int matrix_coefficients,
int video_full_range_flag);
577 void ComputeYCbCr2RgbMatrix(
int matrix_coefficients,
int video_full_range_flag,
int bit_depth,
bool normalized_input,
bool normalized_output, YUVRGBParams *p);
588 cudaError_t ConvertYUVNV12ToRGBA(
cudaStream_t stream,
const YUVRGBParams *params,
const void *yuv,
size_t yuvRowBytes,
void *dst,
size_t dstRowBytes);
621 const YUVRGBParams *yuvParams,
const void *yuvBuffer,
size_t yuvRowBytes,
622 void *rgbBuffer,
size_t rgbRowBytes, cudaTextureObject_t rgbTex,
623 unsigned numWarps,
const Warp360Params *paramArray,
void **dstBuffers,
const size_t *dstRowBytes);
628 #ifdef MULTIWARP_IMPLEMENTATION
634 const YUVRGBParams *yuvParams,
const void *yuvBuffer,
size_t yuvRowBytes,
635 void *rgbBuffer,
size_t rgbRowBytes, cudaTextureObject_t rgbTex,
636 unsigned numWarps,
const Warp360Params *paramArray,
void **dstBuffers,
const size_t *dstRowBytes)
638 cudaError_t cuErr = cudaSuccess;
643 cuErr = ConvertYUVNV12ToRGBA(stream, yuvParams, yuvBuffer, yuvRowBytes, rgbBuffer, rgbRowBytes);
644 if (cudaSuccess != cuErr)
647 for (; numWarps--; ++paramArray, ++dstBuffers, ++dstRowBytes)
649 cuErr = warper.setParams(paramArray);
650 if (cudaSuccess != cuErr)
652 cuErr = warper.warp(stream, rgbTex, *dstBuffers, *dstRowBytes);
653 if (cudaSuccess != cuErr)
665 #endif // __cplusplus
666 #endif // __WARP360_H__
nvwarpResult NVWARPAPI nvwarpSrcToRay(const nvwarpHandle han, uint32_t numPts, const float *pts2D, float *rays3D)
Convert source coordinates into normalized rays.
nvwarpResult NVWARPAPI nvwarpSrcFromRay(const nvwarpHandle han, uint32_t numRays, const float *rays3D, float *pts2D)
Convert rays into source coordinates.
void NVWARPAPI nvwarpSetSrcFocalLengths(nvwarpHandle han, float fl, float fy)
Set the source focal length.
void NVWARPAPI nvwarpGetSrcWidthHeight(const nvwarpHandle han, uint32_t wh[2])
Get the source image dimensions.
@ NVWARP_FISHEYE_EQUIRECT
Fisheye to equirectangular.
void *NVWARPAPI nvwarpGetUserData(nvwarpHandle han)
Get the current value of the user data pointer.
JDIMENSION JDIMENSION * width
void NVWARPAPI nvwarpSetBlock(nvwarpHandle han, dim3 dim_block)
Set the CUDA block size.
@ NVWARP_FISHEYE_FISHEYE
Fisheye to fisheye.
void NVWARPAPI nvwarpSetPixelPhase(nvwarpHandle han, uint32_t phase)
Set the pixel phase.
float NVWARPAPI nvwarpGetSrcFocalLength(const nvwarpHandle han, float *fy)
Get one or both source focal lengths.
void NVWARPAPI nvwarpSetDstWidthHeight(nvwarpHandle han, uint32_t w, uint32_t h)
Set the destination width and height.
void NVWARPAPI nvwarpSetDistortion(nvwarpHandle han, const float d[5])
Set the distortion coefficients.
@ NVWARP_PERSPECTIVE_EQUIRECT
Perspective to equirectangular.
nvwarpResult NVWARPAPI nvwarpSetWarpType(nvwarpHandle han, nvwarpType_t type)
Set the warp type.
void NVWARPAPI nvwarpGetRotation(const nvwarpHandle han, float R[9])
Get the rotation matrix.
@ NVWARP_NONE
This makes it 32 bits.
void NVWARPAPI nvwarpSetRotation(nvwarpHandle han, const float R[9])
Specify the rotation.
@ NVWARP_EQUIRECT_STEREOGRAPHIC
Equirectangular to generalized stereographic.
void NVWARPAPI nvwarpSetUserData(nvwarpHandle han, void *userData)
Set the user data pointer.
nvwarpType_t
Warp type enumeration.
nvwarpResult NVWARPAPI nvwarpInverseWarpCoordinates(const nvwarpHandle han, uint32_t numPts, const float *inPtsXY, float *outPtsXY)
Transform coordinates from the destination space to the source space.
void NVWARPAPI nvwarpSetDstPrincipalPoint(nvwarpHandle han, const float xy[2], uint32_t relToCenter)
Set the destination principal point.
nvwarpResult NVWARPAPI nvwarpWarpBuffer(const nvwarpHandle han, cudaStream_t stream, cudaTextureObject_t srcTex, void *dstAddr, size_t dstRowBytes)
Warp an image texture to a buffer.
void NVWARPAPI nvwarpGetDstWidthHeight(const nvwarpHandle han, uint32_t wh[2])
Get the destination width and height.
@ NVWARP_FISHEYE_PANINI
Fisheye to Panini.
@ NVWARP_FISHEYE_CYLINDER
Fisheye to horizontally panned cylinder.
void NVWARPAPI nvwarpGetDistortion(const nvwarpHandle han, float d[5])
Get the distortion coefficients.
@ NVWARP_FISHEYE_PERSPECTIVE
Fisheye to perspective.
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 heig...
uint32_t NVWARPAPI nvwarpGetPixelPhase(const nvwarpHandle han)
Get the pixel phase.
void NVWARPAPI nvwarpSetControl(nvwarpHandle han, uint32_t index, float control)
Set a control parameter.
nvwarpType_t NVWARPAPI nvwarpGetWarpType(const nvwarpHandle han)
Get the type of the warp.
float NVWARPAPI nvwarpGetControl(const nvwarpHandle han, uint32_t index)
Get the value for the control parameters.
float NVWARPAPI nvwarpGetDstFocalLength(const nvwarpHandle han, float *fy)
Get one or both destination focal lengths.
nvwarpResult
Error code enumerations for NVWarp360.
nvwarpResult NVWARPAPI nvwarpDstFromRay(const nvwarpHandle han, uint32_t numRays, const float *rays3D, float *pts2D)
Convert rays into destination coordinates.
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.
nvwarpResult NVWARPAPI nvwarpWarpSurface(const nvwarpHandle han, cudaStream_t stream, cudaTextureObject_t srcTex, cudaSurfaceObject_t dstSurface)
Warp an image texture to a surface.
nvwarpResult NVWARPAPI nvwarpWarpCoordinates(const nvwarpHandle han, uint32_t numPts, const float *inPtsXY, float *outPtsXY)
Transform coordinates from the input space to the output space.
@ NVWARP_PERSPECTIVE_PERSPECTIVE
Perspective to perspective.
@ NVWARP_EQUIRECT_PANINI
Equirectangular to Panini.
@ NVWARP_EQUIRECT_PERSPECTIVE
Equirectangular to perspective.
@ NVWARP_EQUIRECT_EQUIRECT
Equirectangular to equirectangular.
void NVWARPAPI nvwarpGetDstPrincipalPoint(const nvwarpHandle han, float xy[2], uint32_t relToCenter)
Get the destination principal point.
void NVWARPAPI nvwarpSetSrcRadius(nvwarpHandle han, float r)
set the source fisheye clipping radius.
@ NVWARP_EQUIRECT_CYLINDER
Equirectangular to cylindrical.
@ NVWARP_EQUIRECT_ROTCYLINDER
Equirectangular to vertical cylindrical.
@ NVWARP_EQUIRECT_FISHEYE
Equirectangular to fisheye.
@ NVWARP_PERSPECTIVE_PANINI
Perspective to Panini.
void NVWARPAPI nvwarpSetSrcPrincipalPoint(nvwarpHandle han, const float xy[2], uint32_t relToCenter)
Specify the principal point of the source image.
float NVWARPAPI nvwarpGetSrcRadius(const nvwarpHandle han)
Get the source fisheye clipping radius.
void NVWARPAPI nvwarpGetBlock(const nvwarpHandle han, dim3 *dim_block)
Get the current value of the CUDA block size.
@ NVWARP_FISHEYE_ROTCYLINDER
Fisheye to vertically panned radial cylinder.
nvwarpResult NVWARPAPI nvwarpDstToRay(const nvwarpHandle han, uint32_t numPts, const float *pts2D, float *rays3D)
Convert destination coordinates into normalized rays.
uint32_t NVWARPAPI nvwarpVersion()
Get the version number, encoded as (major_version * 16777216u + minor * 65536u + revision * 256u).
@ NVWARP_FISHEYE_PUSHBROOM
Fisheye to pushbroom.
void NVWARPAPI nvwarpGetSrcPrincipalPoint(const nvwarpHandle han, float xy[2], uint32_t relToCenter)
Get the source principal point.
void NVWARPAPI nvwarpSetSrcWidthHeight(nvwarpHandle han, uint32_t w, uint32_t h)
Set the source dimensions.
@ NVWARP_EQUIRECT_PUSHBROOM
Equirectangular to pushbroom.
void NVWARPAPI nvwarpSetDstFocalLengths(nvwarpHandle han, float fl, float fy)
Set the destination focal length.