Template Class BorderVarShapeWrap
Defined in File BorderVarShapeWrap.hpp
Inheritance Relationships
Base Type
public nvcv::cuda::detail::BorderIWImpl< T, B >
(Template Class BorderIWImpl)
Class Documentation
-
template<typename T, NVCVBorderType B>
class BorderVarShapeWrap : public nvcv::cuda::detail::BorderIWImpl<T, B> Border var-shape wrapper class used to wrap an ImageBatchVarShapeWrap adding border handling to it.
This class wraps an ImageBatchVarShapeWrap to add border handling functionality. It provides the methods
ptr
andoperator
[] to do the same semantic access (pointer or reference) in the wrapped ImageBatchVarShapeWrap but border aware on width and height as active dimensions.using PixelType = ...; using ImageBatchWrap = ImageBatchVarShapeWrap<PixelType>; using BorderVarShape = BorderVarShapeWrap<PixelType, NVCV_BORDER_REPLICATE>; ImageBatchWrap dst(...); ImageBatchWrap srcImageBatch(...); BorderVarShape src(srcImageBatch); dim3 grid{...}, block{...}; int2 fillBorderSize{2, 2}; FillBorder<<<grid, block>>>(dst, src, src.numImages(), fillBorderSize); template<typename T, NVCVBorderType B> __global__ void FillBorder(ImageBatchVarShapeWrap<T> dst, BorderVarShapeWrap<T, B> src, int ns, int2 bs) { int3 dstCoord = StaticCast<int>(blockIdx * blockDim + threadIdx); if (dstCoord.x >= dst.width(dstCoord.z) || dstCoord.y >= dst.height(dstCoord.z) || dstCoord.z >= ns) return; int3 srcCoord = {dstCoord.x - bs.x, dstCoord.y - bs.y, dstCoord.z}; dst[dstCoord] = src[srcCoord]; }
- Template Parameters:
T – Type (it can be const) of each element inside the image batch var-shape wrapper.
B – It is a NVCVBorderType indicating the border to be used.
Public Functions
-
BorderVarShapeWrap() = default
- inline explicit __host__ __device__ BorderVarShapeWrap (ImageBatchWrapper imageBatchWrap, ValueType borderValue={})
Constructs a BorderVarShapeWrap by wrapping an
imageBatchWrap
.- Parameters:
imageBatchWrap – [in] An ImageBatchVarShapeWrap object to be wrapped.
borderValue – [in] The border value is ignored in non-constant border types.
-
inline explicit __host__ BorderVarShapeWrap(const ImageBatchVarShapeDataStridedCuda &images, ValueType borderValue = {})
Constructs a BorderVarShapeWrap by wrapping
images
.- Parameters:
images – [in] A
ImageBatchVarShapeDataStridedCuda
with image batch information.borderValue – [in] The border value is ignored in non-constant border types.
- inline __host__ __device__ ValueType & operator[] (int4 c) const
Subscript operator for read-only or read-and-write access (depending on value type).
- Parameters:
c – [in] 4D coordinate (w sample, z plane, y row and x column) to be accessed.
- Returns:
Accessed (const) reference.
- inline __host__ __device__ ValueType & operator[] (int3 c) const
Subscript operator for read-only or read-and-write access (depending on value type, considering plane=0).
- Parameters:
c – [in] 3D coordinate (z sample, y row and x column) to be accessed.
- Returns:
Accessed (const) reference.
- inline __host__ __device__ ValueType * ptr (int s, int p, int y, int x) const
Get a read-only or read-and-write proxy (as pointer) at the given coordinates.
- Parameters:
s – [in] Sample image index in the list.
p – [in] Plane index in the selected image.
y – [in] Row index in the selected image.
x – [in] Column index in the selected image.
- Returns:
The (const) pointer to the beginning of the given coordinates.
- inline __host__ __device__ ValueType * ptr (int s, int y, int x) const
Get a read-only or read-and-write proxy (as pointer) at 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 (const) pointer to the beginning of the given coordinates.
- inline const __host__ __device__ ImageBatchWrapper & imageBatchWrap () const
Public Static Attributes
-
static constexpr NVCVBorderType kBorderType
-
static constexpr int kNumDimensions