Template Class ImageBatchVarShapeWrap

Inheritance Relationships

Derived Type

Class Documentation

template<typename T>
class ImageBatchVarShapeWrap

Image batch var-shape wrapper class to wrap ImageBatchVarShapeDataStridedCuda.

ImageBatchVarShapeWrap is a wrapper of an image batch (or a list of images) of variable shapes. The template parameter T is the type of each element inside the wrapper, and it can be compound type to represent a pixel type, e.g. uchar4 for RGBA images.

 cudaStream_t stream;
 cudaStreamCreate(&stream);
 nvcv::ImageBatchVarShape imageBatch(samples);
auto *imageBatchData  = imageBatch.exportData<nvcv::ImageBatchVarShapeDataStridedCuda>(stream)
 nvcv::cuda::ImageBatchVarShapeWrap<uchar4> wrap(*imageBatchData);
 // Now wrap can be used in device code to access elements of the image batch via operator[] or ptr method.

Image batch var-shape wrapper class to wrap ImageBatchVarShapeDataStridedCuda.

This class is specialized for non-constant value type.

Template Parameters:
  • T – Type (it can be const) of each element inside the image batch var-shape wrapper.

  • T – Type (non-const) of each element inside the image batch var-shape wrapper.

Subclassed by nvcv::cuda::ImageBatchVarShapeWrapNHWC< T >

Public Types

using ValueType = T

Public Functions

ImageBatchVarShapeWrap() = default
inline __host__ ImageBatchVarShapeWrap(const ImageBatchVarShapeDataStridedCuda &images)

Constructs a ImageBatchVarShapeWrap by wrapping an images argument.

Parameters:

images[in] Reference to the list of images that will be wrapped.

inline __host__ __device__ T & operator[] (int4 c) const

Subscript operator for read-and-write access.

Parameters:

c[in] 4D coordinates (w sample, z plane, y row and x column) to be accessed.

Returns:

Accessed reference.

inline __host__ __device__ T & operator[] (int3 c) const

Subscript operator for read-and-write access (considering plane = 0).

Parameters:

c[in] 3D coordinates (z sample, y row and x column) to be accessed.

Returns:

Accessed reference.

inline __host__ __device__ T * ptr (int s, int p, int y, int x) const

Get a read-and-write proxy (as pointer) of the given coordinates.

Parameters:
  • s[in] Sample image index in the list.

  • p[in] Plane index in the image.

  • y[in] Row index in the selected image.

  • x[in] Column index in the selected image.

Returns:

The pointer to the beginning of the given coordinates.

inline __host__ __device__ T * ptr (int s, int y, int x) const

Get a read-and-write proxy (as pointer) of the given coordinates (considering plane=0).

Parameters:
  • s[in] Sample image index in the list.

  • y[in] Row index in the selected image.

  • x[in] Column index in the selected image.

Returns:

The pointer to the beginning of the given coordinates.

inline __host__ __device__ T * ptr (int s, int y) const

Get a read-and-write proxy (as pointer) of the given coordinates (considering plane=0).

Parameters:
  • s[in] Sample image index in the list.

  • y[in] Row index in the selected image.

Returns:

The pointer to the beginning of the given coordinates.

inline __host__ __device__ int height (int s, int p=0) const

Get height of plane p of image s sample.

Parameters:
  • s[in] Sample image index in the list.

  • p[in] Plane index in the image.

Returns:

The height of the given image plane in batch.

inline const __host__ __device__ NVCVImagePlaneStrided plane (int s, int p=0) const

Get plane p of image s sample.

Parameters:
  • s[in] Sample image index in the list.

  • p[in] Plane index in the image.

Returns:

The plane of the given image sample in batch.

inline __host__ __device__ int rowStride (int s, int p=0) const

Get row stride in bytes of plane p of image s sample.

Parameters:
  • s[in] Sample image index in the list.

  • p[in] Plane index in the image.

Returns:

The row stride in bytes of the given image plane in batch.

inline __host__ __device__ int width (int s, int p=0) const

Get width of plane p of image s sample.

Parameters:
  • s[in] Sample image index in the list.

  • p[in] Plane index in the image.

Returns:

The width of the given image plane in batch.

Public Static Attributes

static constexpr int kConstantStrides
static constexpr int kNumDimensions
static constexpr int kVariableStrides

Protected Functions

inline __host__ __device__ T * doGetPtr (int s, int p, int y, int x) const