Class ImageBatchVarShape

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class ImageBatchVarShape : public nvcv::ImageBatch

Represents a batch of images with variable shapes.

Extends the functionality provided by the ImageBatch class to support batches of images where each image might have a different shape or size.

Public Types

using Requirements = NVCVImageBatchVarShapeRequirements
using ConstIterator = Iterator

Public Functions

inline ImageBatchVarShape(const ImageBatchVarShape &other)
inline ImageBatchVarShape(ImageBatchVarShape &&other)
inline ImageBatchVarShape &operator=(const ImageBatchVarShape &other)
inline ImageBatchVarShape &operator=(ImageBatchVarShape &&other)
inline explicit ImageBatchVarShape(NVCVImageBatchHandle &&handle)

Construct from an existing NVCV handle.

inline ImageBatchVarShape(const ImageBatch &batch)

Construct from an existing ImageBatch.

inline ImageBatchVarShape(ImageBatch &&batch)

Move construct from an existing ImageBatch.

inline explicit ImageBatchVarShape(const Requirements &reqs, const Allocator &alloc = nullptr)

Construct with specific requirements.

inline explicit ImageBatchVarShape(int32_t capacity, const Allocator &alloc = nullptr)

Construct with a specified capacity.

inline ImageBatchVarShape &operator=(const ImageBatch &batch)
inline ImageBatchVarShape &operator=(ImageBatch &&batch)
template<class IT>
void pushBack(IT itBeg, IT itend)
inline void pushBack(const Image &img)
inline void popBack(int32_t imgCount = 1)
template<class F, class = decltype(std::declval<F>()())>
inline void pushBack(F &&cb)

Adds images produced by the callback.

This function appends images produced by the callback until it returns an image with a null handle.

Note

When the callback returns NVCVImageHandle, it is assumed that the callback transfers the ownership of the handle reference - the reference count will not be incremented when the object is added to the batch.

Parameters:

cb – A callable objects that takes no parameters and returns nvcv::Image, reference to nvcv::Image, an object convertible to nvcv::Image.

inline void clear()

Clear all images from the batch.

inline Size2D maxSize() const

Get the maximum size among all images in the batch.

Returns:

The maximum size.

inline ImageFormat uniqueFormat() const

Determine the unique format of the images in the batch if applicable.

Returns:

The unique format, or an invalid format if images have different formats.

inline Image operator[](ptrdiff_t n) const

Access a specific image in the batch.

Parameters:

n – The index of the image.

Returns:

The image at the specified index.

inline ConstIterator begin() const
inline ConstIterator end() const
inline ConstIterator cbegin() const
inline ConstIterator cend() const
inline ImageBatchVarShapeData exportData(CUstream stream) const

Export the underlying data of the image batch.

Parameters:

stream – The CUDA stream.

Returns:

The image batch data.

inline ImageBatch &operator=(const ImageBatch &other)
inline ImageBatch &operator=(ImageBatch &&other)
inline ImageBatchData exportData(CUstream stream) const

Export the underlying data of the image batch.

Parameters:

stream – The CUDA stream.

Returns:

The image batch data.

template<typename Data>
Optional<Data> exportData(CUstream stream) const

Export the underlying data of the image batch with a specific type.

Template Parameters:

Data – The type to cast the data to.

Parameters:

stream – The CUDA stream.

Returns:

The image batch data casted to the specified type.

template<typename DATA>
Optional<DATA> exportData(CUstream stream) const

Public Static Functions

static inline Requirements CalcRequirements(int32_t capacity)

Calculate requirements for a variable-shaped image batch with a specific capacity.

Parameters:

capacity – The capacity for which requirements need to be calculated.

Returns:

The requirements for creating a batch with the specified capacity.

static inline bool IsCompatibleKind(NVCVTypeImageBatch kind)

Check if a specific kind is compatible with the ImageBatchVarShape class.

Parameters:

kind – The kind to check.

Returns:

True if the kind is NVCV_TYPE_IMAGEBATCH_VARSHAPE, false otherwise.

class Iterator

Public Types

using value_type = Image
using reference = const Image&
using pointer = const Image*
using iterator_category = std::random_access_iterator_tag
using difference_type = int32_t

Public Functions

Iterator() = default
inline reference operator*() const
inline pointer operator->() const
inline Iterator operator++(int)
inline Iterator &operator++()
inline Iterator operator--(int)
inline Iterator &operator--()
inline Iterator operator+(difference_type diff) const
inline Iterator operator-(difference_type diff) const
inline difference_type operator-(const Iterator &that) const
inline bool operator==(const Iterator &that) const
inline bool operator!=(const Iterator &that) const
inline bool operator<(const Iterator &that) const
inline bool operator>(const Iterator &that) const
inline bool operator<=(const Iterator &that) const
inline bool operator>=(const Iterator &that) const