NVIDIA DeepStream SDK API Reference

9.2 Release
ReIDFrameTransformTexture Class Reference

Detailed Description

Crops and rescales target regions through CUDA texture transforms.

Definition at line 28 of file sources/libs/nvmultiobjecttracker/include/modules/ReID/ReIDFrameTransformTexture.hpp.

Inheritance diagram for ReIDFrameTransformTexture:
Collaboration diagram for ReIDFrameTransformTexture:

Public Member Functions

 ReIDFrameTransformTexture ()
 Construct a ReIDFrameTransformTexture instance. More...
 
 ~ReIDFrameTransformTexture ()
 Release resources owned by the ReIDFrameTransformTexture instance. More...
 
void initialize (const int debugVerboseLevel, const int maxStreamNum, const int maxBufSurfAddrSize, const int maxTargetNum, const NvMotDataTypes::Size srcImgSize, const uint srcImgPitch, const NvBufSurfaceColorFormat colorFormatType, const NvMotDataTypes::Size dstImgSize, const NvBufSurfaceColorFormat dstColorFormatType, const int dimOrder)
 Initialize for image cropping and scaling. More...
 
bool frameTransformInBatch (const std::map< NvMOTStreamId, std::vector< std::pair< uint, NvMotDataTypes::Rect2f > > > &roisInBatch, const uint lastBboxInd, const float outputScaleFactor, const std::vector< float > outputOffsets)
 Transform (crop, scale and color conversion) a set of bboxes for the given single frame, all the bboxes will be scaled to the same size. More...
 
bool frameTransformInBatch_NV12 (const std::map< NvMOTStreamId, std::vector< std::pair< uint, NvMotDataTypes::Rect2f > > > &roisInBatch, const uint lastBboxInd, const float outputScaleFactor, const std::vector< float > outputOffsets)
 Transform (crop, scale and color conversion) a set of bboxes for the given single frame, all the bboxes will be scaled to the same size. More...
 
float * getOutputImagePatchPtrs ()
 Get the pointer to the output image patches on device memory with metadata. More...
 
 ReIDFrameTransformTexture ()
 Construct a ReIDFrameTransformTexture instance. More...
 
 ~ReIDFrameTransformTexture ()
 Release resources owned by the ReIDFrameTransformTexture instance. More...
 
void initialize (const int debugVerboseLevel, const int maxStreamNum, const int maxBufSurfAddrSize, const int maxTargetNum, const NvMotDataTypes::Size srcImgSize, const uint srcImgPitch, const NvBufSurfaceColorFormat colorFormatType, const NvMotDataTypes::Size dstImgSize, const NvBufSurfaceColorFormat dstColorFormatType, const int dimOrder)
 Initialize for image cropping and scaling. More...
 
bool frameTransformInBatch (const std::map< NvMOTStreamId, std::vector< std::pair< uint, NvMotDataTypes::Rect2f > > > &roisInBatch, const uint lastBboxInd, const float outputScaleFactor, const std::vector< float > outputOffsets)
 Transform (crop, scale and color conversion) a set of bboxes for the given single frame, all the bboxes will be scaled to the same size. More...
 
bool frameTransformInBatch_NV12 (const std::map< NvMOTStreamId, std::vector< std::pair< uint, NvMotDataTypes::Rect2f > > > &roisInBatch, const uint lastBboxInd, const float outputScaleFactor, const std::vector< float > outputOffsets)
 Transform (crop, scale and color conversion) a set of bboxes for the given single frame, all the bboxes will be scaled to the same size. More...
 
float * getOutputImagePatchPtrs ()
 Get the pointer to the output image patches on device memory with metadata. More...
 
void initialize_common (const int debugVerboseLevel, const int maxStreamNum, const int maxBufSurfAddrSize, const int maxTargetNum, const NvMotDataTypes::Size srcImgSize, const uint srcImgPitch, const NvBufSurfaceColorFormat colorFormatType)
 Initialize common transform state and allocate output memory. More...
 
void initialize_common (const int debugVerboseLevel, const int maxStreamNum, const int maxBufSurfAddrSize, const int maxTargetNum, const NvMotDataTypes::Size srcImgSize, const uint srcImgPitch, const NvBufSurfaceColorFormat colorFormatType)
 Initialize common transform state and allocate output memory. More...
 
void updateTextureObject (const std::map< NvMOTStreamId, NvMOTFrame * > &inputMeta)
 Update texture objects from a batch of source frames. More...
 
void updateTextureObject (const std::map< NvMOTStreamId, NvMOTFrame * > &inputMeta)
 Update texture objects from a batch of source frames. More...
 
NvBufSurfaceColorFormat getColorFormat () const
 Get the input surface color format. More...
 
NvBufSurfaceColorFormat getColorFormat () const
 Get the input surface color format. More...
 
uint getMaxVideoStreams () const
 Get the maximum number of video streams in a batch. More...
 
uint getMaxVideoStreams () const
 Get the maximum number of video streams in a batch. More...
 
bool isInitialized_common () const
 Report whether common frame-transform state is initialized. More...
 
bool isInitialized_common () const
 Report whether common frame-transform state is initialized. More...
 

Protected Member Functions

void allocateOutputMemories_common ()
 Allocate device and host memory for transform output. More...
 
void allocateOutputMemories_common ()
 Allocate device and host memory for transform output. More...
 
void deAllocateOutputMemories_common ()
 Release device and host memory for transform output. More...
 
void deAllocateOutputMemories_common ()
 Release device and host memory for transform output. More...
 

Protected Attributes

bool m_isInit_common
 Indicates whether common transform state is initialized. More...
 
std::shared_ptr< FrameInputTexture > m_frameInput
 Shared input-frame texture manager. More...
 
float4 * m_rois_h
 
float4 * m_rois_d
 Host and device regions of interest in x, y, width, and height order. More...
 
uint2 * m_dstOffsets_h
 
uint2 * m_dstOffsets_d
 Host and device byte offsets into transform output memory. More...
 
std::map< uint, std::pair< NvMOTStreamId, uint > > m_targetNumInd2RoisInBatchMapper
 Stream and bounding-box indices keyed by batch target index. More...
 
int m_scaleFactor
 Scale that restores values read through normalized CUDA texture mode. More...
 
uint m_lastInd
 Number of targets in the latest transform. More...
 
uint m_numFramesInBatchMax
 Maximum number of frames processed in a batch. More...
 
int m_maxTargetsToTrack
 Maximum number of targets in a batch. More...
 
const int m_cudaBlockSize_2D
 CUDA block width and height for two-dimensional kernels. More...
 
cudaStream_t m_cuStream
 CUDA stream used for frame transformations. More...
 
int m_debugVerboseLevel
 Debug verbosity level. More...
 

Constructor & Destructor Documentation

◆ ReIDFrameTransformTexture() [1/2]

ReIDFrameTransformTexture::ReIDFrameTransformTexture ( )

Construct a ReIDFrameTransformTexture instance.

◆ ~ReIDFrameTransformTexture() [1/2]

ReIDFrameTransformTexture::~ReIDFrameTransformTexture ( )

Release resources owned by the ReIDFrameTransformTexture instance.

◆ ReIDFrameTransformTexture() [2/2]

ReIDFrameTransformTexture::ReIDFrameTransformTexture ( )

Construct a ReIDFrameTransformTexture instance.

◆ ~ReIDFrameTransformTexture() [2/2]

ReIDFrameTransformTexture::~ReIDFrameTransformTexture ( )

Release resources owned by the ReIDFrameTransformTexture instance.

Member Function Documentation

◆ allocateOutputMemories_common() [1/2]

void FrameTransformTexture::allocateOutputMemories_common ( )
protectedinherited

Allocate device and host memory for transform output.

◆ allocateOutputMemories_common() [2/2]

void FrameTransformTexture::allocateOutputMemories_common ( )
protectedinherited

Allocate device and host memory for transform output.

◆ deAllocateOutputMemories_common() [1/2]

void FrameTransformTexture::deAllocateOutputMemories_common ( )
protectedinherited

Release device and host memory for transform output.

◆ deAllocateOutputMemories_common() [2/2]

void FrameTransformTexture::deAllocateOutputMemories_common ( )
protectedinherited

Release device and host memory for transform output.

◆ frameTransformInBatch() [1/2]

bool ReIDFrameTransformTexture::frameTransformInBatch ( const std::map< NvMOTStreamId, std::vector< std::pair< uint, NvMotDataTypes::Rect2f > > > &  roisInBatch,
const uint  lastBboxInd,
const float  outputScaleFactor,
const std::vector< float >  outputOffsets 
)

Transform (crop, scale and color conversion) a set of bboxes for the given single frame, all the bboxes will be scaled to the same size.

Parameters
[in]roisInBatchThe set of ROIs of interest {videoStreamID, a vector of {bboxInd, bbox} }.
[in]lastBboxIndLast bbox index.
[in]outputScaleFactorScale applied to output pixel values.
[in]outputOffsetsParameter of each channel's offset.
Returns
Status.

◆ frameTransformInBatch() [2/2]

bool ReIDFrameTransformTexture::frameTransformInBatch ( const std::map< NvMOTStreamId, std::vector< std::pair< uint, NvMotDataTypes::Rect2f > > > &  roisInBatch,
const uint  lastBboxInd,
const float  outputScaleFactor,
const std::vector< float >  outputOffsets 
)

Transform (crop, scale and color conversion) a set of bboxes for the given single frame, all the bboxes will be scaled to the same size.

Parameters
[in]roisInBatchThe set of ROIs of interest {videoStreamID, a vector of {bboxInd, bbox} }.
[in]lastBboxIndLast bbox index.
[in]outputScaleFactorScale applied to output pixel values.
[in]outputOffsetsParameter of each channel's offset.
Returns
Status.

◆ frameTransformInBatch_NV12() [1/2]

bool ReIDFrameTransformTexture::frameTransformInBatch_NV12 ( const std::map< NvMOTStreamId, std::vector< std::pair< uint, NvMotDataTypes::Rect2f > > > &  roisInBatch,
const uint  lastBboxInd,
const float  outputScaleFactor,
const std::vector< float >  outputOffsets 
)

Transform (crop, scale and color conversion) a set of bboxes for the given single frame, all the bboxes will be scaled to the same size.

Parameters
[in]roisInBatchThe set of ROIs of interest {videoStreamID, a vector of {bboxInd, bbox} }.
[in]lastBboxIndLast bbox index.
[in]outputScaleFactorScale applied to output pixel values.
[in]outputOffsetsParameter of each channel's offset.
Returns
Status.

◆ frameTransformInBatch_NV12() [2/2]

bool ReIDFrameTransformTexture::frameTransformInBatch_NV12 ( const std::map< NvMOTStreamId, std::vector< std::pair< uint, NvMotDataTypes::Rect2f > > > &  roisInBatch,
const uint  lastBboxInd,
const float  outputScaleFactor,
const std::vector< float >  outputOffsets 
)

Transform (crop, scale and color conversion) a set of bboxes for the given single frame, all the bboxes will be scaled to the same size.

Parameters
[in]roisInBatchThe set of ROIs of interest {videoStreamID, a vector of {bboxInd, bbox} }.
[in]lastBboxIndLast bbox index.
[in]outputScaleFactorScale applied to output pixel values.
[in]outputOffsetsParameter of each channel's offset.
Returns
Status.

◆ getColorFormat() [1/2]

NvBufSurfaceColorFormat FrameTransformTexture::getColorFormat ( ) const
inlineinherited

◆ getColorFormat() [2/2]

NvBufSurfaceColorFormat FrameTransformTexture::getColorFormat ( ) const
inlineinherited

◆ getMaxVideoStreams() [1/2]

uint FrameTransformTexture::getMaxVideoStreams ( ) const
inlineinherited

Get the maximum number of video streams in a batch.

Definition at line 247 of file 9.2/sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

References FrameTransformTexture::m_numFramesInBatchMax.

◆ getMaxVideoStreams() [2/2]

uint FrameTransformTexture::getMaxVideoStreams ( ) const
inlineinherited

Get the maximum number of video streams in a batch.

Definition at line 247 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

References FrameTransformTexture::m_numFramesInBatchMax.

◆ getOutputImagePatchPtrs() [1/2]

float* ReIDFrameTransformTexture::getOutputImagePatchPtrs ( )
inline

Get the pointer to the output image patches on device memory with metadata.

Definition at line 83 of file 9.2/sources/libs/nvmultiobjecttracker/include/modules/ReID/ReIDFrameTransformTexture.hpp.

◆ getOutputImagePatchPtrs() [2/2]

float* ReIDFrameTransformTexture::getOutputImagePatchPtrs ( )
inline

Get the pointer to the output image patches on device memory with metadata.

Definition at line 83 of file sources/libs/nvmultiobjecttracker/include/modules/ReID/ReIDFrameTransformTexture.hpp.

◆ initialize() [1/2]

void ReIDFrameTransformTexture::initialize ( const int  debugVerboseLevel,
const int  maxStreamNum,
const int  maxBufSurfAddrSize,
const int  maxTargetNum,
const NvMotDataTypes::Size  srcImgSize,
const uint  srcImgPitch,
const NvBufSurfaceColorFormat  colorFormatType,
const NvMotDataTypes::Size  dstImgSize,
const NvBufSurfaceColorFormat  dstColorFormatType,
const int  dimOrder 
)

Initialize for image cropping and scaling.

Parameters
[in]debugVerboseLevelDebug verbosity level.
[in]maxStreamNumMaximum number of input streams.
[in]maxBufSurfAddrSizeMaximum number of cached surface-buffer addresses.
[in]maxTargetNumMaximum number of targets in a batch.
[in]srcImgSizeInput image dimensions.
[in]srcImgPitchInput image pitch in bytes.
[in]colorFormatTypeInput surface color format.
[in]dstImgSizeSize of image after resizing.
[in]dstColorFormatTypeOutput color format RGB or BGR.
[in]dimOrderOutput tensor dimension order.

◆ initialize() [2/2]

void ReIDFrameTransformTexture::initialize ( const int  debugVerboseLevel,
const int  maxStreamNum,
const int  maxBufSurfAddrSize,
const int  maxTargetNum,
const NvMotDataTypes::Size  srcImgSize,
const uint  srcImgPitch,
const NvBufSurfaceColorFormat  colorFormatType,
const NvMotDataTypes::Size  dstImgSize,
const NvBufSurfaceColorFormat  dstColorFormatType,
const int  dimOrder 
)

Initialize for image cropping and scaling.

Parameters
[in]debugVerboseLevelDebug verbosity level.
[in]maxStreamNumMaximum number of input streams.
[in]maxBufSurfAddrSizeMaximum number of cached surface-buffer addresses.
[in]maxTargetNumMaximum number of targets in a batch.
[in]srcImgSizeInput image dimensions.
[in]srcImgPitchInput image pitch in bytes.
[in]colorFormatTypeInput surface color format.
[in]dstImgSizeSize of image after resizing.
[in]dstColorFormatTypeOutput color format RGB or BGR.
[in]dimOrderOutput tensor dimension order.

◆ initialize_common() [1/2]

void FrameTransformTexture::initialize_common ( const int  debugVerboseLevel,
const int  maxStreamNum,
const int  maxBufSurfAddrSize,
const int  maxTargetNum,
const NvMotDataTypes::Size  srcImgSize,
const uint  srcImgPitch,
const NvBufSurfaceColorFormat  colorFormatType 
)
inherited

Initialize common transform state and allocate output memory.

Parameters
[in]debugVerboseLevelDebug verbosity level.
[in]maxStreamNumMaximum number of input streams.
[in]maxBufSurfAddrSizeMaximum number of cached surface-buffer addresses.
[in]maxTargetNumMaximum number of targets in a batch.
[in]srcImgSizeInput image dimensions.
[in]srcImgPitchInput image pitch in bytes.
[in]colorFormatTypeInput surface color format.

◆ initialize_common() [2/2]

void FrameTransformTexture::initialize_common ( const int  debugVerboseLevel,
const int  maxStreamNum,
const int  maxBufSurfAddrSize,
const int  maxTargetNum,
const NvMotDataTypes::Size  srcImgSize,
const uint  srcImgPitch,
const NvBufSurfaceColorFormat  colorFormatType 
)
inherited

Initialize common transform state and allocate output memory.

Parameters
[in]debugVerboseLevelDebug verbosity level.
[in]maxStreamNumMaximum number of input streams.
[in]maxBufSurfAddrSizeMaximum number of cached surface-buffer addresses.
[in]maxTargetNumMaximum number of targets in a batch.
[in]srcImgSizeInput image dimensions.
[in]srcImgPitchInput image pitch in bytes.
[in]colorFormatTypeInput surface color format.

◆ isInitialized_common() [1/2]

bool FrameTransformTexture::isInitialized_common ( ) const
inlineinherited

Report whether common frame-transform state is initialized.

Definition at line 250 of file 9.2/sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

References FrameTransformTexture::m_isInit_common.

◆ isInitialized_common() [2/2]

bool FrameTransformTexture::isInitialized_common ( ) const
inlineinherited

Report whether common frame-transform state is initialized.

Definition at line 250 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

References FrameTransformTexture::m_isInit_common.

◆ updateTextureObject() [1/2]

void FrameTransformTexture::updateTextureObject ( const std::map< NvMOTStreamId, NvMOTFrame * > &  inputMeta)
inherited

Update texture objects from a batch of source frames.

Parameters
[in]inputMetaSource frames keyed by stream ID.

◆ updateTextureObject() [2/2]

void FrameTransformTexture::updateTextureObject ( const std::map< NvMOTStreamId, NvMOTFrame * > &  inputMeta)
inherited

Update texture objects from a batch of source frames.

Parameters
[in]inputMetaSource frames keyed by stream ID.

Field Documentation

◆ m_cudaBlockSize_2D

const int FrameTransformTexture::m_cudaBlockSize_2D
protectedinherited

CUDA block width and height for two-dimensional kernels.

Definition at line 276 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_cuStream

cudaStream_t FrameTransformTexture::m_cuStream
protectedinherited

CUDA stream used for frame transformations.

Definition at line 277 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_debugVerboseLevel

int FrameTransformTexture::m_debugVerboseLevel
protectedinherited

◆ m_dstOffsets_d

uint2 * FrameTransformTexture::m_dstOffsets_d
protectedinherited

Host and device byte offsets into transform output memory.

Definition at line 266 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_dstOffsets_h

uint2 * FrameTransformTexture::m_dstOffsets_h
protectedinherited

◆ m_frameInput

std::shared_ptr< FrameInputTexture > FrameTransformTexture::m_frameInput
protectedinherited

◆ m_isInit_common

bool FrameTransformTexture::m_isInit_common
protectedinherited

Indicates whether common transform state is initialized.

Definition at line 259 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

Referenced by FrameTransformTexture::isInitialized_common().

◆ m_lastInd

uint FrameTransformTexture::m_lastInd
protectedinherited

Number of targets in the latest transform.

Definition at line 271 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_maxTargetsToTrack

int FrameTransformTexture::m_maxTargetsToTrack
protectedinherited

Maximum number of targets in a batch.

Definition at line 273 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_numFramesInBatchMax

uint FrameTransformTexture::m_numFramesInBatchMax
protectedinherited

Maximum number of frames processed in a batch.

Definition at line 272 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

Referenced by FrameTransformTexture::getMaxVideoStreams().

◆ m_rois_d

float4 * FrameTransformTexture::m_rois_d
protectedinherited

Host and device regions of interest in x, y, width, and height order.

Definition at line 265 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_rois_h

float4 * FrameTransformTexture::m_rois_h
protectedinherited

◆ m_scaleFactor

int FrameTransformTexture::m_scaleFactor
protectedinherited

Scale that restores values read through normalized CUDA texture mode.

Definition at line 270 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_targetNumInd2RoisInBatchMapper

std::map< uint, std::pair< NvMOTStreamId, uint > > FrameTransformTexture::m_targetNumInd2RoisInBatchMapper
protectedinherited

Stream and bounding-box indices keyed by batch target index.

Definition at line 267 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.


The documentation for this class was generated from the following file: