BorderVarShapeWrap classes

group NVCV_CPP_CUDATOOLS_BORDERVARSHAPEWRAP
template<typename T, NVCVBorderType B>
class BorderVarShapeWrap : public nvcv::cuda::detail::BorderIWImpl<T, B>
#include <BorderVarShapeWrap.hpp>

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 and operator[] 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.

template<typename T>
class BorderVarShapeWrap<T, NVCV_BORDER_CONSTANT> : public nvcv::cuda::detail::BorderIWImpl<T, NVCV_BORDER_CONSTANT>
#include <BorderVarShapeWrap.hpp>

Border var-shape wrapper class specialized for NVCV_BORDER_CONSTANT.

Template Parameters:

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

template<typename T, NVCVBorderType B>
class BorderVarShapeWrapNHWC : public nvcv::cuda::detail::BorderIWImpl<T, B>
#include <BorderVarShapeWrap.hpp>
template<typename T>
class BorderVarShapeWrapNHWC<T, NVCV_BORDER_CONSTANT> : public nvcv::cuda::detail::BorderIWImpl<T, NVCV_BORDER_CONSTANT>
#include <BorderVarShapeWrap.hpp>

Border var-shape wrapper class specialized for NVCV_BORDER_CONSTANT.

Template Parameters:

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