Image Wrapper classes
- group Image Wrapper classes
-
template<typename T>
class ImageBatchVarShapeWrap - #include <ImageBatchVarShapeWrap.hpp>
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
Tis 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.
Note
No accessor in this class bounds-checks the sample index
sor the plane indexp, and the two fail differently: an out-of-rangesreads past the end of the image list, while an out-of-rangepbelow the fixed plane capacity reads unpopulated plane metadata and yields a wild base pointer. Bound both in the caller first. In a kernel guard that means the sample check has to short-circuit ahead of any accessor.Note
As in the const specialization it derives from, no accessor bounds-checks the sample index
sor the plane indexp.- 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 >
-
template<typename T>
class ImageBatchVarShapeWrap<const T> - #include <ImageBatchVarShapeWrap.hpp>
-
template<typename T>
class ImageBatchVarShapeWrapNHWC : private nvcv::cuda::ImageBatchVarShapeWrap<T> - #include <ImageBatchVarShapeWrap.hpp>
Image batch var-shape wrapper NHWC class to wrap ImageBatchVarShapeDataStridedCuda and number of channels.
This class handles number of channels as a separate run-time parameter instead of built-in
T. It considers interleaved channels, where they appear in a packed sequence at the last dimension (thus NHWC). It also considers each image in the batch has a single plane.Note
The class ImageBatchVarShapeWrap can be used with its template parameter
Ttype as a compound type, where its number of elements yield the number of channels.Note
As in ImageBatchVarShapeWrap, no accessor bounds-checks the sample index
s; bound it in the caller first. The inherited plane accessorsplane,width,heightandrowStridedo not boundpin any build, while the element accessors of this class always address plane 0. The constructor’s single-plane assert validates only the wrapped images, never an accessor argument, and is compiled out whenNDEBUGis defined, so a release build silently addresses a multi-plane image as its plane 0.- Template Parameters:
T – Type (it can be const) of each element inside this wrapper.
-
template<typename T>