Operators

cvcuda.adaptivethreshold()
cvcuda.adaptivethreshold(src: cvcuda.Tensor, max_value: float, adaptive_method: cvcuda.AdaptiveThresholdType = cvcuda.AdaptiveThresholdType.MEAN_C,

threshold_type: cvcuda.ThresholdType = cvcuda.ThresholdType.BINARY, block_size: int, c: float, stream: Optional[cvcuda.Stream] = None) -> cvcuda.Tensor

Executes the adaptive threshold operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the AdaptiveThreshold operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • max_value (float) – Non-zero value assigned to the pixels for which the condition is satisfied.

  • adaptive_method (cvcuda.AdaptiveThresholdType) – Adaptive threshold algorithm to use.

  • threshold_type (cvcuda.ThresholdType) – Threshold type that must be either cvcuda.ThresholdType.BINARY or cvcuda.ThresholdType.BINARY_INV.

  • block_size (int) – Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.

  • c (float) – Constant subtracted from the mean or weighted mean. Normally, it is positive but may be zero or negative as well.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.adaptivethreshold(src: cvcuda.ImageBatchVarShape, max_value: cvcuda.Tensor, adaptive_method: cvcuda.AdaptiveThresholdType = cvcuda.AdaptiveThresholdType.MEAN_C, threshold_type: cvcuda.ThresholdType = cvcuda.ThresholdType.BINARY, block_size: int, c: float, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the adaptive threshold operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the AdaptiveThreshold operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing the result of the operation.

  • max_value (cvcuda.Tensor) – Non-zero value assigned to the pixels for which the condition is satisfied, specified per image.

  • adaptive_method (cvcuda.AdaptiveThresholdType) – Adaptive threshold algorithm to use.

  • threshold_type (cvcuda.ThresholdType) – Threshold type that must be either cvcuda.ThresholdType.BINARY or cvcuda.ThresholdType.BINARY_INV.

  • max_block_size (int) – The maximum block size that will be used by the operator.

  • block_size (cvcuda.Tensor) – Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on, specified per image.

  • c (cvcuda.Tensor) – Constant subtracted from the mean or weighted mean. Normally, it is positive but may be zero or negative as well, specified per image.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.advcvtcolor(src: cvcuda.Tensor, code: cvcuda.ColorConversion, spec: cvcuda.ColorSpec, *, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Adv Cvt Color operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Adv Cvt Color operator for more details and usage examples.

Parameters:
Returns:

The output color converted image.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.averageblur(src: cvcuda.Tensor, kernel_size: Tuple[int, int], kernel_anchor: Tuple[int, int], border: cvcuda.Border = cvcuda.Border.CONSTANT, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the AverageBlur operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the AverageBlur operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • kernel_size (Tuple[int, int]) – Specifies the size of the blur kernel.

  • kernel_anchor (Tuple[int, int]) – Kernel anchor, use (-1,-1) to indicate kernel center.

  • border (cvcuda.Border, optional) – Border mode to be used when accessing elements outside input image.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

See also

Refer to the CV-CUDA C API reference for the AverageBlur operator for more details and usage examples.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.averageblur(src: cvcuda.ImageBatchVarShape, kernel_size: Tuple[int, int], kernel_anchor: Tuple[int, int], border: cvcuda.Border = cvcuda.Border.CONSTANT, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the AverageBlur operation with a variable shape tensors on the given cuda stream.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • max_kernel_size (Tuple[int, int]) – Specifies the maximum size of the blur kernel.

  • kernel_size (Tuple[int, int]) – Specifies the size of the blur kernel within the maximum kernel size.

  • kernel_anchor (Tuple[int, int]) – Kernel anchor, use (-1,-1) to indicate kernel center.

  • border (cvcuda.Border, optional) – Border mode to be used when accessing elements outside input image.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.bilateral_filter(src: cvcuda.Tensor, diameter: int, sigma_color: float, sigma_space: float, border: cvcuda.Border = cvcuda.Border.CONSTANT, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Bilateral Filter operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Bilateral Filter operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • diameter (int) – Bilateral filter diameter.

  • sigma_color (float) – Gaussian exponent for color difference.

  • sigma_space (float) – Gaussian exponent for position difference.

  • border (cvcuda.Border, optional) – Border mode to be used when accessing elements outside input image.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.bilateral_filter(src: cvcuda.ImageBatchVarShape, diameter: cvcuda.Tensor, sigma_color: cvcuda.Tensor, sigma_space: cvcuda.Tensor, border: cvcuda.Border = cvcuda.Border.CONSTANT, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Bilateral Filter operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Bilateral Filter operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input tensor containing one or more images.

  • diameter (cvcuda.Tensor) – Bilateral filter diameters in each image.

  • sigma_color (cvcuda.Tensor) – Gaussian exponents for color difference in each image.

  • sigma_space (cvcuda.Tensor) – Gaussian exponents for position difference in each image.

  • border (cvcuda.Border, optional) – Border mode to be used when accessing elements outside input image.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.bndbox(src: cvcuda.Tensor, bboxes: capsule, *, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the BndBox operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the BndBox operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • bboxes (cvcuda.BndBoxesI) – Bounding boxes in reference to the input tensor.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.boxblur(src: cvcuda.Tensor, bboxes: capsule, *, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the BoxBlur operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the BoxBlur operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • bboxes (cvcuda.BlurBoxesI) – Blur boxes in reference to the input tensor.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.brightness_contrast(src: cvcuda.Tensor, brightness: cvcuda.Tensor, contrast: cvcuda.Tensor, brightness_shift: cvcuda.Tensor, contrast_center: cvcuda.Tensor, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Adjusts the brightness and contrast of the images according to the formula: out = brightness_shift + brightness * (contrast_center + contrast * (in - contrast_center)).

See also

Refer to the CV-CUDA C API reference for the BrightnessContrast operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor.

  • brightness (cvcuda.Tensor, optional) – Optional tensor describing brightness multiplier. If specified, it must contain only 1 element. If not specified, the neutral 1. is used.

  • contrast (cvcuda.Tensor, optional) – Optional tensor describing contrast multiplier. If specified, it must contain only 1 element. If not specified, the neutral 1. is used.

  • brightness_shift (cvcuda.Tensor, optional) – Optional tensor describing brightness shift. If specified, it must contain only 1 element. If not specified, the neutral 0. is used.

  • contrast_center (cvcuda.Tensor, optional) – Optional tensor describing contrast center. If specified, it must contain only 1 element. If not specified, the middle of the assumed input type range is used. For floats it is 0.5, for unsigned integer types it is 2 * (number_of_bits - 1), for signed integer types it is 2 * (number_of_bits - 2).

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

cvcuda.brightness_contrast(src: cvcuda.ImageBatchVarShape, brightness: cvcuda.Tensor, contrast: cvcuda.Tensor, brightness_shift: cvcuda.Tensor, contrast_center: cvcuda.Tensor, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Adjusts the brightness and contrast of the images according to the formula: out = brightness_shift + brightness * (contrast_center + contrast * (in - contrast_center)).

The brightness/brightness_shift/contrast/contrast_center tensors’ length must match the number of samples in the batch.

See also

Refer to the CV-CUDA C API reference for the BrightnessContrast operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input tensor.

  • brightness (cvcuda.Tensor, optional) – Optional tensor describing brightness multiplier. If specified, it must contain 1 or N elements where N is the number of input images. If it contains a single element, the same value is used for all input images. If not specified, the neutral 1. is used.

  • contrast (cvcuda.Tensor, optional) – Optional tensor describing contrast multiplier. If specified, it must contain either 1 or N elements where N is the number of input images. If it contains a single element, the same value is used for all input images. If not specified, the neutral 1. is used.

  • brightness_shift (cvcuda.Tensor, optional) – Optional tensor describing brightness shift. If specified, it must contain either 1 or N elements where N is the number of input images. If it contains a single element, the same value is used for all input images. If not specified, the neutral 0. is used.

  • contrast_center (cvcuda.Tensor, optional) – Optional tensor describing contrast center. If specified, it must contain either 1 or N elements where N is the number of input images. If it contains a single element, the same value is used for all input images. If not specified, the middle of the assumed input type range is used. For floats it is 0.5, for unsigned integer types it is 2 * (number_of_bits - 1), for signed integer types it is 2 * (number_of_bits - 2).

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

cvcuda.center_crop(src: cvcuda.Tensor, crop_size: tuple[int, int], *, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Center Crop operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Center Crop operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • crop_size (Tuple[int, int]) – Crop size in width and height.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.channelreorder(src: cvcuda.ImageBatchVarShape, order: cvcuda.Tensor, *, format: cvcuda.Format | None = None, stream: cvcuda.Stream | None = None) cvcuda.ImageBatchVarShape

Executes the Channel Reorder operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Channel Reorder operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input tensor containing one or more images.

  • order (cvcuda.Tensor) – 2D tensor with layout “NC” which specifies, for each output image sample in the batch, the index of the input channel to copy to the output channel.

  • format (cvcuda.Format) – Format of the destination image.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.color_twist(*args, **kwargs)

Overloaded function.

  1. color_twist(src: cvcuda.Tensor, twist: cvcuda.Tensor, *, stream: Optional[cvcuda.Stream] = None) -> cvcuda.Tensor

    cvcuda.color_twist(src: cvcuda.Tensor, twist: cvcuda.Tensor, stream: Optional[cvcuda.Stream] = None) -> cvcuda.Tensor

    Transforms an image by applying affine transformation to the channels extent.

    See Also:

    Refer to the CV-CUDA C API reference for the ColorTwist operator for more details and usage examples.

    Args:
    src (cvcuda.Tensor): Tensor corresponding to the input image. It must have

    either 3 or 4 channels. In the case of 4 channels, the alpha channel is unmodified.

    twist (cvcuda.Tensor): A 2D tensor describing a 3x4 affine transformation matrix. stream (cvcuda.Stream, optional): CUDA Stream on which to perform the operation.

    Returns:

    cvcuda.Tensor: The output tensor.

  2. color_twist(src: cvcuda.ImageBatchVarShape, twist: cvcuda.Tensor, *, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

    cvcuda.color_twist(src: cvcuda.ImageBatchVarShape, twist: cvcuda.Tensor, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

    Transforms a batch of images by applying affine transformation to the channels extent.

    See Also:

    Refer to the CV-CUDA C API reference for the ColorTwist operator for more details and usage examples.

    Args:
    src (cvcuda.ImageBatchVarShape): Input image batch. Each image must have either 3 or 4

    channels. In the case of 4 channels the alpha channel is unmodified.

    twist (cvcuda.Tensor): A 3x4 2D tensor describing an affine transformation matrix or a

    Nx3x4 3D tensor specifying separate transformations for each sample in the input image batch.

    stream (cvcuda.Stream, optional): CUDA Stream on which to perform the operation.

    Returns:

    cvcuda.ImageBatchVarShape: The output image batch.

cvcuda.composite(foreground: cvcuda.Tensor, background: cvcuda.Tensor, fgmask: cvcuda.Tensor, outchannels: int, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Composite operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Composite operator for more details and usage examples.

Parameters:
  • foreground (cvcuda.Tensor) – Input tensor containing one or more foreground images. Each image is BGR (3-channel) 8-bit.

  • background (cvcuda.Tensor) – Input tensor containing one or more background images. Each image is BGR (3-channel) 8-bit.

  • fgmask (cvcuda.Tensor) – Input foreground mask tensor. Each mask image is grayscale 8-bit

  • outchannels (int) – Specifies 3 channel for RGB and 4 channel for BGRA.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.composite(foreground: cvcuda.ImageBatchVarShape, background: cvcuda.ImageBatchVarShape, fgmask: cvcuda.ImageBatchVarShape, outchannels: int, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Composite operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Composite operator for more details and usage examples.

Parameters:
  • foreground (cvcuda.ImageBatchVarShape) – Input tensor containing one or more foreground images. Each image is BGR (3-channel) 8-bit.

  • background (cvcuda.ImageBatchVarShape) – Input tensor containing one or more background images. Each image is BGR (3-channel) 8-bit.

  • fgmask (cvcuda.ImageBatchVarShape) – Input foreground mask image batch. Each mask image is grayscale 8-bit.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.conv2d(src: cvcuda.ImageBatchVarShape, kernel: cvcuda.ImageBatchVarShape, kernel_anchor: cvcuda.Tensor, border: cvcuda.Border = <Border.CONSTANT: 0>, *, stream: Optional[cvcuda.Stream] = None) cvcuda.ImageBatchVarShape

Executes the Convolve 2D operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Convolve 2D operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • kernel (cvcuda.Tensor) – Convolution kernels (one for each batch image) to be used. Each image width and height correspond to the kernel width and height. (must be float)

  • kernel_anchor (cvcuda.Tensor) – 1D Tensor with the anchor of each kernel (one for each batch image). The anchor (x, y) indicates the relative position of a filtered point within the kernel. (-1, -1) means that the anchor is at the kernel center.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.convertto(src: cvcuda.Tensor, dtype: cvcuda.Type, scale: float = 1, offset: float = 0, *, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Convert To operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Convert To operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • scale (float, optional) – Scalar for output data.

  • offset (float, optional) – Offset for the data.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.copymakeborder(src: cvcuda.Tensor, border_mode: cvcuda.Border = cvcuda.Border.CONSTANT, border_value: List[float], top: int, bottom: int, right: int, stream: Optional[cvcuda.Stream] = None) cvcuda.Tensor

Executes the Copy Make Border operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Copy Make Border operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • border_mode (cvcuda.Border, optional) – Border mode to be used when accessing elements outside input image.

  • border_value (List[float], optional) – Border value to be used for constant border mode, each element of the array corresponds to the image color channel must be a size <= 4 and dim of 1, where the values specify the border color for each color channel.

  • top (int) – The top pixel position.

  • left (int) – The left pixel position.

  • bottom (int) – The bottom pixel position.

  • right (int) – The right pixel position.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.copymakeborder(src: cvcuda.ImageBatchVarShape, border_mode: cvcuda.Border = cvcuda.Border.CONSTANT, border_value: List[float], top: int, bottom: int, right: int, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Copy Make Border operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Copy Make Border operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • border_mode (cvcuda.Border, optional) – Border mode to be used when accessing elements outside input image.

  • border_value (List[float], optional) – Border value to be used for constant border mode, each element of the array corresponds to the image color channel must be a size <= 4 and dim of 1, where the values specify the border color for each color channel.

  • top (cvcuda.Tensor) – The top pixel position for each image.

  • left (cvcuda.Tensor) – The left pixel position for each image.

  • out_heights (cvcuda.Tensor) – The heights of each output image.

  • out_widths (cvcuda.Tensor) – The widths of each output image.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.copymakeborderstack(src: cvcuda.ImageBatchVarShape, border_mode: cvcuda.Border = cvcuda.Border.CONSTANT, border_value: List[float], top: int, bottom: int, right: int, stream: Optional[cvcuda.Stream] = None) cvcuda.Tensor

Executes the Copy Make Border Stack operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Copy Make Border Stack operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • border_mode (cvcuda.Border, optional) – Border mode to be used when accessing elements outside input image.

  • border_value (List[float], optional) – Border value to be used for constant border mode, each element of the array corresponds to the image color channel must be a size <= 4 and dim of 1, where the values specify the border color for each color channel.

  • top (cvcuda.Tensor) – The top pixel position for each image.

  • left (cvcuda.Tensor) – The left pixel position for each image.

  • out_height (int) – The height of the output.

  • out_width (int) – The width of the output.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output images.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.crop_flip_normalize_reformat(src: cvcuda.ImageBatchVarShape, out_shape: tuple, out_dtype: cvcuda.Type, out_layout: cvcuda.TensorLayout, rect: cvcuda.Tensor, flip_code: cvcuda.Tensor, base: cvcuda.Tensor, scale: cvcuda.Tensor, globalscale: float = 1.0, globalshift: float = 0.0, epsilon: float = 0.0, flags: Optional[int] = None, border: cvcuda.Border = <Border.CONSTANT: 0>, bvalue: float = 0, *, stream: Optional[cvcuda.Stream] = None) cvcuda.Tensor

Executes the CropFlipNormalizeReformat operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the CropFlipNormalizeReformat operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • out_shape (tuple) – The shape of the output.

  • out_dtype (numpy.dtype) – The data type of the output.

  • out_layout (cvcuda.TensorLayout) – The layout of the output.

  • rect (cvcuda.Tensor) – The crop rectangle tensor which has shape of [batch_size, 1, 1, 4] in reference to the input tensor. The crop value of [crop_x, crop_y, crop_width, crop_height] stored in the final dimension of the crop tensor, provided per image.

  • flip_code (cvcuda.Tensor) – A tensor flag to specify how to flip the array; 0 means flipping around the x-axis, 1 means flipping around the y-axis, -1 means flipping around both axes, and any other value will result in no flip, provided per image.

  • base (cvcuda.Tensor) – Tensor providing base values for normalization.

  • scale (cvcuda.Tensor) – Tensor providing scale values for normalization.

  • globalscale (float, optional) – Additional scale value to be used in addition to scale

  • globalshift (float, optional) – Additional bias value to be used in addition to base.

  • epsilon (float, optional) – Epsilon to use when CVCUDA_NORMALIZE_SCALE_IS_STDDEV flag is set as a regularizing term to be added to variance.

  • flags (int, optional) – Algorithm flags, use CVCUDA_NORMALIZE_SCALE_IS_STDDEV if scale passed as argument is standard deviation instead or 0 if it is scaling.

  • border (cvcuda.Border, optional) – Border mode to be used when accessing elements outside input image.

  • bvalue (float, optional) – Border value to be used for constant border mode cvcuda.Border.CONSTANT.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

None

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.customcrop(src: cvcuda.Tensor, rect: cvcuda.RectI, *, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Custom Crop operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Custom Crop operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • rect (cvcuda.RectI) – Crop rectangle in reference to the input tensor.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.cvtcolor(src: cvcuda.Tensor, code: cvcuda.ColorConversion, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the CVT Color operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the CVT Color operator for more details and usage examples.

Parameters:
Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.cvtcolor(src: cvcuda.ImageBatchVarShape, code: cvcuda.ColorConversion, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the CVT Color operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the CVT Color operator for more details and usage examples.

Parameters:
Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.erase(src: cvcuda.Tensor, anchor: cvcuda.Tensor, erasing: cvcuda.Tensor, values: cvcuda.Tensor, imgIdx: cvcuda.Tensor, random: int, seed: int, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Erase operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Erase operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • anchor (cvcuda.Tensor) – anchor an array of size num_erasing_area that gives the x coordinate and y coordinate of the top left point in the eraseing areas.

  • erasing (cvcuda.Tensor) – Eraisng an array of size num_erasing_area that gives the widths of the eraseing areas, the heights of the eraseing areas and integers in range 0-15, each of whose bits indicates whether or not the corresponding channel need to be erased.

  • values (cvcuda.Tensor) – An array of size num_erasing_area*4 that gives the filling value for each erase area.

  • imgIdx (cvcuda.Tensor) – An array of size num_erasing_area that maps a erase area idx to img idx in the batch.

  • random (int, optional) – 8-bit integer value for random op.

  • seed (int, optional) – seed random seed for random filling erase area.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.erase(src: cvcuda.ImageBatchVarShape, anchor: cvcuda.Tensor, erasing: cvcuda.Tensor, values: cvcuda.Tensor, imgIdx: cvcuda.Tensor, random: int, seed: int, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Erase operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Erase operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • anchor (cvcuda.Tensor) – anchor an array of size num_erasing_area that gives the x coordinate and y coordinate of the top left point in the eraseing areas.

  • erasing (cvcuda.Tensor) – Eraisng an array of size num_erasing_area that gives the widths of the eraseing areas, the heights of the eraseing areas and integers in range 0-15, each of whose bits indicates whether or not the corresponding channel need to be erased.

  • values (cvcuda.Tensor) – An array of size num_erasing_area*4 that gives the filling value for each erase area.

  • imgIdx (cvcuda.Tensor) – An array of size num_erasing_area that maps a erase area idx to img idx in the batch.

  • random (int, optional) – 8-bit integer value for random op.

  • seed (int, optional) – seed random seed for random filling erase area.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.findhomography(srcPts: cvcuda.Tensor, dstPts: cvcuda.Tensor, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Estimates the homography matrix between srcPts and dstPts coordinates on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Find Homography operator for more details and usage examples.

Parameters:
  • srcPts (cvcuda.Tensor) – Input source coordinates tensor containing 2D coordinates in the source image.

  • dstPts (cvcuda.Tensor) – Input destination coordinates tensor containing 2D coordinates in the target image.

  • stream (Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The model homography matrix tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.findhomography(srcPts: cvcuda.TensorBatch, dstPts: cvcuda.TensorBatch, stream: Optional[cvcuda.Stream] = None) -> TensorBatch

Executes the Find Homography operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Find Homography operator for more details and usage examples.

Parameters:
  • srcPts (cvcuda.TensorBatch) – Input source coordinates tensor containing 2D coordinates in the source image.

  • dstPts (cvcuda.TensorBatch) – Input destination coordinates tensor containing 2D coordinates in the target image.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The model homography matrix tensor batch.

Return type:

cvcuda.TensorBatch

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.flip(src: cvcuda.Tensor, flipCode: int, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Flip operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Flip operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • flipCode (int) – Flag to specify how to flip the array; 0 means flipping around the x-axis and positive value (for example, 1) means flipping around y-axis. Negative value (for example, -1) means flipping around both axes.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.flip(src: cvcuda.ImageBatchVarShape, flipCode: cvcuda.Tensor, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Flip operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Flip operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • flipCode (cvcuda.Tensor) – Flag to specify how to flip the array; 0 means flipping around the x-axis and positive value (for example, 1) means flipping around y-axis. Negative value (for example, -1) means flipping around both axes. Specified for all images in batch.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.gamma_contrast(src: cvcuda.ImageBatchVarShape, gamma: cvcuda.Tensor, *, stream: cvcuda.Stream | None = None) cvcuda.ImageBatchVarShape

Executes the Gamma Contrast operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Gamma Contrast operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input tensor containing one or more images.

  • gamma (cvcuda.Tensor) – 1D Tensor with the the gamma value for each image / image channel.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.gaussian(src: cvcuda.Tensor, kernel_size: Tuple[int, int], sigma: Tuple[double, double], border: border_mode: cvcuda.Border, stream: Optional[cvcuda.Stream] = None) cvcuda.Tensor

Executes the Gaussian operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Gaussian operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • kernel_size (Tuple[int, int]) – Kernel width, height.

  • sigma (Tuple[double, double]) – Gaussian kernel standard deviation in X,Y directions.

  • border (cvcuda.Border, optional) – Border mode to be used when accessing elements outside input image.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.gaussian(src: cvcuda.ImageBatchVarShape, kernel_size: cvcuda.Tensor, sigma: cvcuda.Tensor, border: border_mode: cvcuda.Border, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Gaussian operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Gaussian operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • kernel_size (cvcuda.Tensor) – Kernel width, height.

  • sigma (cvcuda.Tensor) – Gaussian kernel standard deviation in X,Y directions.

  • border (cvcuda.Border, optional) – Border mode to be used when accessing elements outside input image.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.gaussiannoise(src: cvcuda.Tensor, mu: cvcuda.Tensor, sigma: cvcuda.Tensor, per_channel: bool, seed: int, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the GaussianNoise operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the GaussianNoise operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input image batch containing one or more images.

  • mu (cvcuda.Tensor) – An array of size batch that gives the mu value of each image.

  • sigma (cvcuda.Tensor) – An array of size batch that gives the sigma value of each image.

  • per_channel (bool) – Whether to add the same noise for all channels.

  • seed (int) – Seed for random numbers.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.gaussiannoise(src: cvcuda.ImageBatchVarShape, mu: cvcuda.Tensor, sigma: cvcuda.Tensor, per_channel: bool, seed: int, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the GaussianNoise operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the GaussianNoise operator for more details and usage examples.

Parameters:
  • src (ImageBatchVarShape) – Input image batch containing one or more images.

  • mu (cvcuda.Tensor) – An array of size batch that gives the mu value of each image.

  • sigma (cvcuda.Tensor) – An array of size batch that gives the sigma value of each image.

  • per_channel (bool) – Whether to add the same noise for all channels.

  • seed (int) – Seed for random numbers.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.histogram(src: cvcuda.Tensor, mask: cvcuda.Tensor | None = None, *, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes an histogram operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Histogram operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images, input tensor must be (N)HWC, currently only grayscale uint8 is supported.

  • mask (cvcuda.Tensor, optional) – Input tensor containing the mask of the pixels to be considered for the histogram, must be the same shape as src.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor containing the histogram. The tensor is formatted as HWC with W = 256 and H = number of input tensors, and C = 1.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.histogrameq(src: cvcuda.Tensor, dtype: numpy.dtype, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the histogram equalization operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Histogram Eq operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input image batch containing one or more images.

  • dtype (numpy.dtype) – The data type of the output.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.histogrameq(src: cvcuda.ImageBatchVarShape, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the histogram equalization operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the HistogramEq operator for more details and usage examples.

Parameters:
Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.hq_resize(*args, **kwargs)

Overloaded function.

  1. hq_resize(src: cvcuda.Tensor, out_size: tuple, *, antialias: Optional[bool] = False, roi: Optional[tuple] = None, interpolation: Optional[cvcuda.Interp] = None, min_interpolation: Optional[cvcuda.Interp] = None, mag_interpolation: Optional[cvcuda.Interp] = None, stream: Optional[cvcuda.Stream] = None) -> cvcuda.Tensor

    Executes the HQ Resize operation on the given cuda stream. The operator supports resampling for 2D (images) and 3D volumetric samples.

    See also:

    Refer to the CV-CUDA C API reference for the HQ Resize operator for more details and usage examples.

    Args:
    src (cvcuda.Tensor): Input tensor containing one or more images.

    The tensor layout must match: (N)(D)HW(C).

    out_size (tuple): Tuple of 2 or 3 ints describing the output shape in (D)HW layout. antialias (bool): If set to true, an antialiasing is enabled for scaling down. roi (Tuple): Optional bounding box describing the input’s region of interest.

    For 2D resampling it should be (lowH, lowW, highH, highW), for 3D: (lowD, lowH, lowW, highD, highH, highW). If, for some axis, the low bound is bigger than the high bound, the image is flipped across the axis.

    interpolation (cvcuda.Interp): Interpolation type used. Used both for scaling down and up,

    cannot be specified together with (min_interpolation or mag_interpolation).

    min_interpolation (cvcuda.Interp): Interpolation type used for scaling down. mag_interpolation (cvcuda.Interp): Interpolation type used for scaling up. stream (cvcuda.Stream, optional): CUDA Stream on which to perform the operation.

    Returns:

    cvcuda.Tensor: The output tensor.

    Caution:

    Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

  2. hq_resize(src: cvcuda.ImageBatchVarShape, out_size: list[tuple[int, int]], *, antialias: Optional[bool] = False, roi: Optional[list[tuple]] = None, interpolation: Optional[cvcuda.Interp] = None, min_interpolation: Optional[cvcuda.Interp] = None, mag_interpolation: Optional[cvcuda.Interp] = None, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

    Executes the HQ Resize operation on the given cuda stream.

    See also:

    Refer to the CV-CUDA C API reference for the HQ Resize operator for more details and usage examples.

    Args:

    src (cvcuda.ImageBatchVarShape): Input batch of images. out_size (tuple): Tuple of 2 ints describing the output shape in HW layout. antialias (bool): If set to true, an antialiasing is enabled for scaling down. roi (List[Tuple[int]]): Optional bounding boxes describing the input’s region of interest.

    It should be a list of tuples. The list length must match the number of input tensors or be 1 (so that the same ROI is used for all samples). Each tuple must be of the form (lowH, lowW, highH, highW). If, for some axis, the low bound is bigger than the high bound, the image is flipped across the axis.

    interpolation (cvcuda.Interp): Interpolation type used. Used both for scaling down and up,

    cannot be specified together with (min_interpolation or mag_interpolation).

    min_interpolation (cvcuda.Interp): Interpolation type used for scaling down. mag_interpolation (cvcuda.Interp): Interpolation type used for scaling up. stream (cvcuda.Stream, optional): CUDA Stream on which to perform the operation.

    Returns:

    cvcuda.ImageBatchVarShape: The batch of resized images.

    Caution:

    Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

  3. hq_resize(src: cvcuda.TensorBatch, out_size: list[tuple], *, antialias: Optional[bool] = False, roi: Optional[list[tuple]] = None, interpolation: Optional[cvcuda.Interp] = None, min_interpolation: Optional[cvcuda.Interp] = None, mag_interpolation: Optional[cvcuda.Interp] = None, stream: Optional[cvcuda.Stream] = None) -> cvcuda.TensorBatch

    Executes the HQ Resize operation on the given cuda stream. The operator supports resampling for 2D (images) and 3D volumetric samples.

    See also:

    Refer to the CV-CUDA C API reference for the HQ Resize operator for more details and usage examples.

    Args:

    src (cvcuda.TensorBatch): Input batch containing one or more tensors of (D)HW(C) layout. out_size (tuple): Tuple of 2 or 3 ints describing the output shape in (D)HW layout. antialias (bool): If set to true, an antialiasing is enabled for scaling down. roi (List[Tuple[int]]): Optional bounding boxes describing the input’s region of interest.

    It should be a list of tuples. The list length must match the number of input tensors or be 1 (so that the same ROI is used for all samples). Each tuple must be of the form:

    • for 2D resampling: (lowH, lowW, highH, highW),

    • for 3D: (lowD, lowH, lowW, highD, highH, highW).

    If, for some axis, the low bound is bigger than the high bound, the tensor is flipped across the axis.

    interpolation (cvcuda.Interp): Interpolation type used. Used both for scaling down and up,

    cannot be specified together with (min_interpolation or mag_interpolation).

    min_interpolation (cvcuda.Interp): Interpolation type used for scaling down. mag_interpolation (cvcuda.Interp): Interpolation type used for scaling up. stream (cvcuda.Stream, optional): CUDA Stream on which to perform the operation.

    Returns:

    cvcuda.TensorBatch: The batch of resized tensors.

    Caution:

    Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.inpaint(src: cvcuda.Tensor, masks: Tensor, inpaintRadius: float, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Inpaint operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Inpaint operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • masks (cvcuda.Tensor) – Mask tensor, 8-bit 1-channel images. Non-zero pixels indicate the area that needs to be inpainted.

  • inpaintRadius (float) – Radius of a circular neighborhood of each point inpainted that is considered by the algorithm.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.inpaint(src: cvcuda.ImageBatchVarShape, masks:ImageBatchVarShape, inpaintRadius: float, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Inpaint operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Inpaint operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • masks (cvcuda.ImageBatchVarShape) – Mask image batch, 8-bit 1-channel images. Non-zero pixels indicate the area that needs to be inpainted.

  • inpaintRadius (float) – Radius of a circular neighborhood of each point inpainted that is considered by the algorithm.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.joint_bilateral_filter(src: cvcuda.Tensor, srcColor: Tensor, diameter: int, sigma_color: float, sigma_space: float, border: cvcuda.Border = cvcuda.Border.CONSTANT, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Joint Bilateral Filter operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Joint Bilateral Filter operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • srcColor (cvcuda.Tensor) – Input tensor for color distance.

  • diameter (int) – Bilateral filter diameter.

  • sigma_color (float) – Gaussian exponent for color difference.

  • sigma_space (float) – Gaussian exponent for position difference.

  • border (cvcuda.Border, optional) – Border mode for input tensor.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.joint_bilateral_filter(src: cvcuda.ImageBatchVarShape, srcColor:ImageBatchVarShape,*, diameter: int, sigma_color: float, sigma_space: float, border: cvcuda.Border = cvcuda.Border.CONSTANT, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Joint Bilateral operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Joint Bilateral operator for more details and usage examples.

Parameters:
Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.label(src: cvcuda.Tensor, connectivity: cvcuda.ConnectivityType = <ConnectivityType.CONNECTIVITY_4_2D: 0>, assign_labels: cvcuda.LABEL = <LABEL.FAST: 0>, mask_type: cvcuda.LabelMaskType = <LabelMaskType.REMOVE_ISLANDS_OUTSIDE_MASK_ONLY: 0>, *, count: bool = False, stats: bool = False, max_labels: int = 10000, bg_label: Optional[cvcuda.Tensor] = None, min_thresh: Optional[cvcuda.Tensor] = None, max_thresh: Optional[cvcuda.Tensor] = None, min_size: Optional[cvcuda.Tensor] = None, mask: Optional[cvcuda.Tensor] = None, stream: Optional[cvcuda.Stream] = None) tuple[cvcuda.Tensor, cvcuda.Tensor | None, cvcuda.Tensor | None]

Executes the Label operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Label operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor to label connected-component regions.

  • connectivity (cvcuda.ConnectivityType, optional) – Choice to control connectivity of input elements, default is cvcuda.CONNECTIVITY_4_2D.

  • assign_labels (cvcuda.LABEL, optional) – Choice on how labels are assigned, default is cvcuda.LABEL.FAST.

  • mask_type (cvcuda.LabelMaskType, optional) – Choice on how the mask is used, default is cvcuda.REMOVE_ISLANDS_OUTSIDE_MASK_ONLY.

  • count (bool, optional) – Use True to return the count of valid labeled regions.

  • stats (bool, optional) – Use True to return the statistics of valid labeled regions.

  • max_labels (Number, optional) – Maximum number of labels to compute statistics for, default is 10000.

  • bg_label (cvcuda.Tensor, optional) – Background tensor to define input values to be considered background labels and thus ignored.

  • min_thresh (cvcuda.Tensor, optional) – Minimum threshold tensor to mask input values below it to be 0, and others 1.

  • max_thresh (cvcuda.Tensor, optional) – Maximum threshold tensor to mask input values above it to be 0, and others 1.

  • min_size (cvcuda.Tensor, optional) – Minimum size tensor to remove islands, i.e. labeled regions with number of elements less than the minimum size.

  • mask (cvcuda.Tensor, optional) – Mask tensor, its behavior is controlled by ref mask_type. One choice is to control island removal in addition to ref min_size, i.e. regions with at least one element inside the mask (non-zero values) are not removed in case mask_type is cvcuda.REMOVE_ISLANDS_OUTSIDE_MASK_ONLY.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

A tuple with output labels, count of regions and their statistics.

The count or stats tensors may be None if theirs arguments are False.

Return type:

Tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.laplacian(src: cvcuda.Tensor, ksize: int, scale: float, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Laplacian operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Laplacian operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • ksize (int) – Aperture size used to compute the second-derivative filters, it can be 1 or 3.

  • scale (float) – Scale factor for the Laplacian values (use 1 for no scale).

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.laplacian(src: cvcuda.ImageBatchVarShape, ksize: cvcuda.Tensor, scale: cvcuda.Tensor, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Laplacian operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Laplacian operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • ksize (cvcuda.Tensor) – Aperture size used to compute the second-derivative filters, it can be 1 or 3 for each image.

  • scale (cvcuda.Tensor) – Scale factor for the Laplacian values (use 1 for no scale) for each image.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.max_loc(*args, **kwargs)

Overloaded function.

  1. max_loc(src: cvcuda.Tensor, max_locations: int = 0, *, stream: Optional[cvcuda.Stream] = None) -> tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]

    Finds maximum on the input tensor.

    See also:

    Refer to the CV-CUDA C API reference for the MinMaxLoc operator for more details and usage examples.

    Args:

    src (cvcuda.Tensor): Input tensor to get minimum/maximum values/locations. max_locations (Number, optional): Number of maximum locations to find, default is 1% of total

    pixels at a minimum of 1.

    stream (cvcuda.Stream, optional): CUDA Stream on which to perform the operation.

    Returns:

    Tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]: A tuple with maximum value, locations and number of maxima.

    Caution:

    Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

  2. max_loc(src: cvcuda.ImageBatchVarShape, max_locations: int = 0, *, stream: Optional[cvcuda.Stream] = None) -> tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]

    Finds maximum on the input batch.

    See also:

    Refer to the CV-CUDA C API reference for the MinMaxLoc operator for more details and usage examples.

    Args:

    src (cvcuda.ImageBatchVarShape): Input image batch to get minimum/maximum values/locations. max_locations (Number, optional): Number of maximum locations to find, default is 1% of total

    pixels at a minimum of 1.

    stream (cvcuda.Stream, optional): CUDA Stream on which to perform the operation.

    Returns:

    Tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]: A tuple with maximum value, locations and number of maxima.

    Caution:

    Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.median_blur(src: cvcuda.Tensor, ksize: Tuple[int, int], stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Median Blur operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Median Blur operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • ksize (Tuple[int, int]) – Width and Height of the kernel.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.median_blur(src: cvcuda.ImageBatchVarShape, ksize: Tuple[int, int], stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Median Blur operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Median Blur operator for more details and usage examples.

Parameters:
Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.minarearect(src: cvcuda.Tensor, numPointsInContour: cvcuda.Tensor, totalContours: int, *, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Min Area Rect operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Min Area Rect operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more contours.src[i,j,k] is the set of contours where i ranges from 0 to batch-1, j ranges from 0 to max number of points in cotours k is the coordinate of each points which is in [0,1]

  • numPointsInContour (cvcuda.Tensor) – Input tensor containing the number of points in each input contours.

  • totalContours (int) – Number of input contours

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor of rotated bounding boxes.The output will give 4 points’ cooridinate(x,y) of each contour’s minimum rotated bounding boxes

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.min_loc(*args, **kwargs)

Overloaded function.

  1. min_loc(src: cvcuda.Tensor, max_locations: int = 0, *, stream: Optional[cvcuda.Stream] = None) -> tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]

    Finds minimum on the input tensor.

    See also:

    Refer to the CV-CUDA C API reference for the MinMaxLoc operator for more details and usage examples.

    Args:

    src (cvcuda.Tensor): Input tensor to get minimum/maximum values/locations. max_locations (Number, optional): Number of maximum locations to find, default is 1% of total

    pixels at a minimum of 1.

    stream (cvcuda.Stream, optional): CUDA Stream on which to perform the operation.

    Returns:

    Tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]: A tuple with minimum value, locations and number of minima.

    Caution:

    Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

  2. min_loc(src: cvcuda.ImageBatchVarShape, max_locations: int = 0, *, stream: Optional[cvcuda.Stream] = None) -> tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]

    Finds minimum on the input batch.

    See also:

    Refer to the CV-CUDA C API reference for the MinMaxLoc operator for more details and usage examples.

    Args:

    src (cvcuda.ImageBatchVarShape): Input image batch to get minimum/maximum values/locations. max_locations (Number, optional): Number of maximum locations to find, default is 1% of total

    pixels at a minimum of 1.

    stream (cvcuda.Stream, optional): CUDA Stream on which to perform the operation.

    Returns:

    Tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]: A tuple with minimum value, locations and number of minima.

    Caution:

    Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.min_max_loc(*args, **kwargs)

Overloaded function.

  1. min_max_loc(src: cvcuda.Tensor, max_locations: int = 0, *, stream: Optional[cvcuda.Stream] = None) -> tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]

    Finds minimum/maximum on the input tensor.

    See also:

    Refer to the CV-CUDA C API reference for the MinMaxLoc operator for more details and usage examples.

    Args:

    src (cvcuda.Tensor): Input tensor to get minimum/maximum values/locations. max_locations (Number, optional): Number of maximum locations to find, default is 1% of total

    pixels at a minimum of 1.

    stream (cvcuda.Stream, optional): CUDA Stream on which to perform the operation.

    Returns:

    Tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]: A tuple with minimum value, locations and number of minima, and also maximum value, locations and number of maxima.

    Caution:

    Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

  2. min_max_loc(src: cvcuda.ImageBatchVarShape, max_locations: int = 0, *, stream: Optional[cvcuda.Stream] = None) -> tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]

    Finds minimum/maximum on the input batch.

    See also:

    Refer to the CV-CUDA C API reference for the MinMaxLoc operator for more details and usage examples.

    Args:

    src (cvcuda.ImageBatchVarShape): Input image batch to get minimum/maximum values/locations. max_locations (Number, optional): Number of maximum locations to find, default is 1% of total

    pixels at a minimum of 1.

    stream (cvcuda.Stream, optional): CUDA Stream on which to perform the operation.

    Returns:

    Tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]: A tuple with minimum value, locations and number of minima, and also maximum value, locations and number of maxima.

    Caution:

    Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.morphology(src: cvcuda.Tensor, morphologyType: cvcuda.MorphologyType, maskSize: Tuple[int, int], anchor: Tuple[int, int], workspace: cvcuda.Tensor, iteration: int, border: cvcuda.Border = cvcuda.Border.CONSTANT, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Morphology operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Morphology operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • morphologyType (cvcuda.MorphologyType) – Type of operation to perform (e.g. cvcuda.MorphologyType.ERODE or cvcuda.MorphologyType.DILATE).

  • maskSize (Tuple[int, int]) – Mask width and height for morphology operation.

  • anchor (Tuple[int, int]) – X,Y offset of kernel, use -1,-1 for center.

  • workspace (cvcuda.Tensor, optional) – Workspace tensor for intermediate results, must be the same size as src. Can be omitted if operation is Dilate/Erode with iteration = 1.

  • iteration (int, optional) – Number of times to run the kernel.

  • border (cvcuda.Border, optional) – Border mode to be used when accessing elements outside input image.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.morphology(src: cvcuda.ImageBatchVarShape, morphologyType: cvcuda.MorphologyType, maskSize: cvcuda.Tensor, anchor: cvcuda.Tensor, workspace: cvcuda.ImageBatchVarShape, iteration: int, border: cvcuda.Border = cvcuda.Border.CONSTANT, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Morphology operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Morphology operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • morphologyType (cvcuda.MorphologyType) – Type of operation to perform (e.g. cvcuda.MorphologyType.ERODE or cvcuda.MorphologyType.DILATE).

  • maskSize (cvcuda.Tensor) – Mask width and height for morphology operation for every image.

  • anchor (cvcuda.Tensor) – X,Y offset of kernel for every image, use -1,-1 for center.

  • workspace (cvcuda.ImageBatchVarShape, optional) – Workspace tensor for intermediate results, must be the same size as src. Can be omitted if operation is Dilate/Erode with iteration = 1.

  • iteration (int, optional) – Number of times to run the kernel.

  • border (cvcuda.Border, optional) – Border mode to be used when accessing elements outside input image.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.nms(src: cvcuda.Tensor, scores: cvcuda.Tensor, score_threshold: float = 1.1920928955078125e-07, iou_threshold: float = 1.0, *, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes NMS.

The Non-Maximum Suppression (NMS) operation reads a set of input bounding boxes (bboxes) proposals and their scores and writes an output boolean mask with suppressed bboxes as zeros and selected bboxes as ones.

See also

Refer to the CV-CUDA C API reference for the Non-Maximum Suppression operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – src[i, j] is the set of input bounding box proposals for an image where i ranges from 0 to batch-1, j ranges from 0 to number of bounding box proposals anchored at the top-left of the bounding box area

  • scores (cvcuda.Tensor) – scores[i, j] are the associated scores for each bounding box proposal in src considered during the reduce operation of NMS

  • score_threshold (float) – Minimum score of a bounding box proposals

  • iou_threshold (float) – Maximum overlap between bounding box proposals covering the same effective image region as calculated by Intersection-over-Union (IoU)

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor of selected bounding boxes.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.normalize(src: cvcuda.Tensor, base: cvcuda.Tensor, scale: cvcuda.Tensor, flags: int, globalscale: float, globalshift: float, epsilon: float, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Normalize operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Normalize operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • base (cvcuda.Tensor) – Tensor providing base values for normalization.

  • scale (cvcuda.Tensor) – Tensor providing scale values for normalization.

  • flags (int, optional) – Algorithm flags, use cvcuda.NormalizeFlags.SCALE_IS_STDDEV if scale passed as argument is standard deviation instead or 0 if it is scaling.

  • globalscale (float, optional) – Additional scale value to be used in addition to scale.

  • globalshift (float, optional) – Additional bias value to be used in addition to base.

  • epsilon (float, optional) – Epsilon to use when cvcuda.NormalizeFlags.SCALE_IS_STDDEV flag is set as a regularizing term to be added to variance.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.normalize(src: cvcuda.ImageBatchVarShape, base: cvcuda.Tensor, scale: cvcuda.Tensor, flags: int, globalscale: float, globalshift: float, epsilon: float, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Normalize operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Normalize operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • base (cvcuda.Tensor) – Tensor providing base values for normalization.

  • scale (cvcuda.Tensor) – Tensor providing scale values for normalization.

  • flags (int, optional) – Algorithm flags, use cvcuda.NormalizeFlags.SCALE_IS_STDDEV if scale passed as argument is standard deviation instead or 0 if it is scaling.

  • globalscale (float, optional) – Additional scale value to be used in addition to scale.

  • globalshift (float, optional) – Additional bias value to be used in addition to base.

  • epsilon (float, optional) – Epsilon to use when cvcuda.NormalizeFlags.SCALE_IS_STDDEV flag is set as a regularizing term to be added to variance.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.osd(src: cvcuda.Tensor, elements: capsule, *, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the OSD operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the OSD operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • elements (cvcuda.Elements) – OSD elements in reference to the input tensor.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.padandstack(src: cvcuda.ImageBatchVarShape, top: cvcuda.Tensor, left: cvcuda.Tensor, border: cvcuda.Border = <Border.CONSTANT: 0>, bvalue: float = 0, *, stream: Optional[cvcuda.Stream] = None) cvcuda.Tensor

Executes the Pad and Stack operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Pad and Stack operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – input image batch containing one or more images.

  • top (cvcuda.Tensor) – Top tensor to store amount of top padding per batch input image.

  • left (cvcuda.Tensor) – Left tensor to store amount of left padding per batch input image.

  • border (cvcuda.Border) – Border mode to be used when accessing elements outside input image.

  • bvalue (float) – Border value to be used for constant border mode.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.match(set1: cvcuda.Tensor, set2: cvcuda.Tensor, num_set1: Optional[cvcuda.Tensor] = None, num_set2: Optional[cvcuda.Tensor] = None, num_matches: Optional[bool] = None, distances: bool = False, cross_check: bool = False, matches_per_point: int = 1, norm_type: Optional[cvcuda.Norm] = None, algo_choice: cvcuda.Matcher = <Matcher.BRUTE_FORCE: 0>, *, stream: Optional[cvcuda.Stream] = None) tuple[cvcuda.Tensor, cvcuda.Tensor | None, cvcuda.Tensor | None]

Executes the Pairwise matcher operation on the given CUDA stream.

See also

Refer to the CV-CUDA C API reference for this operator for more details and usage examples.

Parameters:
  • set1 (cvcuda.Tensor) – Input tensor with 1st set of points.

  • set2 (cvcuda.Tensor) – Input tensor with 2nd set of points.

  • num_set1 (cvcuda.Tensor, optional) – Input tensor with number of valid points in the 1st set. If not provided, consider the entire set1 containing valid points.

  • num_set2 (cvcuda.Tensor, optional) – Input tensor with number of valid points in the 2nd set. If not provided, consider the entire set2 containing valid points.

  • num_matches (bool, optional) – Use True to return the number of matches. If not provided, it is set to True if crossCheck=True and False otherwise.

  • distances (bool, optional) – Use True to return the match distances.

  • cross_check (bool, optional) – Use True to cross check best matches, a best match is only returned if it is the best match (minimum distance) from 1st set to 2nd set and vice versa.

  • matches_per_point (Number, optional) – Number of best matches to return per point.

  • norm_type (cvcuda.Norm, optional) – Choice on how distances are normalized. Defaults to cvcuda.Norm.L2.

  • algo_choice (cvcuda.Matcher, optional) – Choice of the algorithm to perform the match.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

A tuple with output matches, number of matches and their distances.

The number of matches tensor may be None if its argument is False. The distances tensor may be None if its argument is False.

Return type:

Tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.pillowresize(src: cvcuda.Tensor, shape: Shape, format: ImageFormat, interp: Interp = cvcuda.Interp.LINEAR, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Pillow Resize operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Pillow Resize operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • shape (tuple) – Shape of the output image.

  • format (cvcuda.Format) – Format of the input and output images.

  • interp (cvcuda.Interp, optional) – Interpolation type used for transform.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.pillowresize(src: cvcuda.ImageBatchVarShape, shape: Tuple[int], format: cvcuda.Format, interp: Interp = cvcuda.Interp.LINEAR, stream: Optional[cvcuda.Stream] = None) ->ImageBatchVarShape

Executes the Pillow Resize operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Pillow Resize operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • sizes (Tuple[int]) – Shapes of output images.

  • interp (cvcuda.Interp, optional) – Interpolation type used for transform.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.random_resized_crop(src: cvcuda.Tensor, shape: Tuple, min_scale: double, max_scale: double, min_ratio: double, max_ratio: double, interp: Interp = cvcuda.Interp.LINEAR, seed: int, stream: Optional[cvcuda.Stream] = None) cvcuda.Tensor

Executes the RandomResizedCrop operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the RandomResizedCrop operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • shape (Tuple) – Shape of output tensor.

  • min_scale (double, optional) – Lower bound for the random area of the crop, before resizing. The scale is defined with respect to the area of the original image.

  • max_scale (double, optional) – Upper bound for the random area of the crop, before resizing. The scale is defined with respect to the area of the original image.

  • min_ratio (double, optional) – Lower bound for the random aspect ratio of the crop, before resizing.

  • max_ratio (double, optional) – Upper bound for the random aspect ratio of the crop, before resizing.

  • interp (cvcuda.Interp, optional) – Interpolation type used for transform.

  • seed (int, optional) – Random seed, should be unsigned int32.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.random_resized_crop(src: cvcuda.ImageBatchVarShape, shape: Tuple, min_scale: double, max_scale: double, min_ratio: double, max_ratio: double, interp: Interp = cvcuda.Interp.LINEAR, seed: int, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the RandomResizedCrop operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the RandomResizedCrop operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • sizes (Tuple vector) – Shapes of output images.

  • min_scale (double, optional) – Lower bound for the random area of the crop, before resizing. The scale is defined with respect to the area of the original image.

  • max_scale (double, optional) – Upper bound for the random area of the crop, before resizing. The scale is defined with respect to the area of the original image.

  • min_ratio (double, optional) – Lower bound for the random aspect ratio of the crop, before resizing.

  • max_ratio (double, optional) – Upper bound for the random aspect ratio of the crop, before resizing.

  • interp (cvcuda.Interp, optional) – Interpolation type used for transform.

  • seed (int, optional) – Random seed, should be unsigned int32.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.reformat(src: cvcuda.Tensor, layout: cvcuda.TensorLayout, *, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Reformat operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Reformat operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • layout (cvcuda.TensorLayout) – The tensor layout of the output tensor ((N)CHW/(N)HWC).

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.remap(*args, **kwargs)

Overloaded function.

  1. remap(src: cvcuda.Tensor, map: cvcuda.Tensor, src_interp: cvcuda.Interp = <Interp.NEAREST: 0>, map_interp: cvcuda.Interp = <Interp.NEAREST: 0>, map_type: cvcuda.Remap = <Remap.ABSOLUTE: 0>, align_corners: bool = False, border: cvcuda.Border = <Border.CONSTANT: 0>, border_value: numpy.ndarray[numpy.float32] = array([], dtype=float32), *, stream: Optional[cvcuda.Stream] = None) -> cvcuda.Tensor

    cvcuda.remap(src: cvcuda.Tensor, map: cvcuda.Tensor, src_interp: cvcuda.Interp = cvcuda.Interp.NEAREST, map_interp: cvcuda.Interp = cvcuda.Interp.NEAREST, map_type: cvcuda.Remap = cvcuda.Remap.ABSOLUTE, align_corners: bool = False, border: cvcuda.Border = cvcuda.Border.CONSTANT, border_value: numpy.ndarray = np.ndarray((0,)), stream: Optional[cvcuda.Stream] = None) -> cvcuda.Tensor

    Executes the Warp Perspective operation on the given cuda stream.

    See also:

    Refer to the CV-CUDA C API reference for the Remap operator for more details and usage examples.

    Args:

    src (cvcuda.Tensor): Input tensor. src_interp (cvcuda.Interp, optional): Interpolation type used when fetching values

    from the source image.

    map_interp (cvcuda.Interp, optional): Interpolation type used when fetching values

    from the map tensor.

    map_type (cvcuda.Remap, optional): This determines how the values inside the map are

    interpreted. If it is cvcuda.Remap.ABSOLUTE the map values are absolute, denormalized positions in the input tensor to fetch values from. If it is cvcuda.Remap.ABSOLUTE_NORMALIZED the map values are absolute, normalized positions in [-1, 1] range to fetch values from the input tensor in a resolution agnostic way. If it is cvcuda.Remap.RELATIVE_NORMALIZED the map values are relative, normalized offsets to be applied to each output position to fetch values from the input tensor, also resolution agnostic.

    align_corners (bool, optional): The remap operation from output to input via the map

    is done in the floating-point domain. If True, they are aligned by the center points of their corner pixels. Otherwise, they are aligned by the corner points of their corner pixels.

    border (cvcuda.Border, optional): pixel extrapolation method (cvcuda.Border.CONSTANT,

    cvcuda.Border.REPLICATE, cvcuda.Border.REFLECT, cvcuda.Border.REFLECT_101, or cvcuda.Border.WRAP).

    border_value (numpy.ndarray, optional): Used to specify values for a constant border,

    should have size <= 4 and dim of 1, where the values specify the border color for each color channel.

    stream (cvcuda.Stream, optional): CUDA Stream on which to perform the operation.

    Returns:

    cvcuda.Tensor: The output tensor.

    Caution:

    Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

  2. remap(src: cvcuda.ImageBatchVarShape, map: cvcuda.Tensor, src_interp: cvcuda.Interp = <Interp.NEAREST: 0>, map_interp: cvcuda.Interp = <Interp.NEAREST: 0>, map_type: cvcuda.Remap = <Remap.ABSOLUTE: 0>, align_corners: bool = False, border: cvcuda.Border = <Border.CONSTANT: 0>, border_value: numpy.ndarray[numpy.float32] = array([], dtype=float32), *, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

    cvcuda.remap(src: cvcuda.ImageBatchVarShape, map: cvcuda.Tensor, src_interp: cvcuda.Interp = cvcuda.Interp.NEAREST, map_interp: cvcuda.Interp = cvcuda.Interp.NEAREST, map_type: cvcuda.Remap = cvcuda.Remap.ABSOLUTE, align_corners: bool = False, border: cvcuda.Border = cvcuda.Border.CONSTANT, border_value: numpy.ndarray = np.ndarray((0,)), stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

    Executes the Warp Perspective operation on the given cuda stream.

    See also:

    Refer to the CV-CUDA C API reference for the Remap operator for more details and usage examples.

    Args:

    src (cvcuda.ImageBatchVarShape): Input image batch. src_interp (cvcuda.Interp, optional): Interpolation type used when fetching values

    from the source image.

    map_interp (cvcuda.Interp, optional): Interpolation type used when fetching values

    from the map tensor.

    map_type (cvcuda.Remap, optional): This determines how the values inside the map are

    interpreted. If it is cvcuda.Remap.ABSOLUTE the map values are absolute, denormalized positions in the input tensor to fetch values from. If it is cvcuda.Remap.ABSOLUTE_NORMALIZED the map values are absolute, normalized positions in [-1, 1] range to fetch values from the input tensor in a resolution agnostic way. If it is cvcuda.Remap.RELATIVE_NORMALIZED the map values are relative, normalized offsets to be applied to each output position to fetch values from the input tensor, also resolution agnostic.

    align_corners (bool, optional): The remap operation from output to input via the map

    is done in the floating-point domain. If True, they are aligned by the center points of their corner pixels. Otherwise, they are aligned by the corner points of their corner pixels.

    border (cvcuda.Border, optional): pixel extrapolation method (cvcuda.Border.CONSTANT,

    cvcuda.Border.REPLICATE, cvcuda.Border.REFLECT, cvcuda.Border.REFLECT_101, or cvcuda.Border.WRAP).

    border_value (numpy.ndarray, optional): Used to specify values for a constant border,

    should have size <= 4 and dim of 1, where the values specify the border color for each color channel.

    stream (cvcuda.Stream, optional): CUDA Stream on which to perform the operation.

    Returns:

    cvcuda.ImageBatchVarShape: The output image batch.

    Caution:

    Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.resize(src: cvcuda.Tensor, shape: Tuple[int], interp: cvcuda.Interp = cvcuda.Interp.LINEAR, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Resize operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Resize operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • shape (Tuple[int]) – Shape of output tensor.

  • interp (cvcuda.Interp, optional) – Interpolation type used for transform.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.resize(src: cvcuda.ImageBatchVarShape, interp: cvcuda.Interp = cvcuda.Interp.LINEAR, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Resize operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Resize operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • sizes (Tuple vector) – Shapes of output images.

  • interp (cvcuda.Interp, optional) – Interpolation type used for transform.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.resize_crop_convert_reformat()
cvcuda.resize_crop_convert_reformat(src: cvcuda.Tensor,

resize_dim: tuple[int,int], interp: cvcuda.Interp, crop_rect: cvcuda.RectI, *, layout: str = “”, data_type: cvcuda.Type = 0, manip: cvcuda.ChannelManip = cvcuda.ChannelManip.NO_OP, scale: float = 1.0, offset: float = 0.0, srcCast: bool = True, stream: Optional[cvcuda.Stream] = None) -> cvcuda.Tensor

Executes the ResizeCropConvertReformat operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the ResizeCropConvertReformat operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • resize_dim (tuple[int,int]) – Dimensions, width & height, of resized tensor (prior to cropping).

  • interp (cvcuda.Interp) – Interpolation type used for resizing. Currently, only cvcuda.Interp.NEAREST and cvcuda.Interp.LINEAR are available.

  • crop_rect (cvcuda.RectI) – Crop rectangle, (top, left, width, height), specifying the top-left corner and width & height dimensions of the region to crop from the resized images.

  • layout (string, optional) – String specifying output tensor layout (e.g., ‘NHWC’ or ‘CHW’). Empty string (default) indicates output tensor layout copies input.

  • data_type (cvcuda.Type, optional) – Data type of output tensor channel (e.g., uint8 or float). 0 (default) indicates output tensor data type copies input.

  • manip (cvcuda.ChannelManip, optional) – Channel manipulation (e.g., shuffle RGB to BGR). NO_OP (default) indicates output tensor channels are unchanged.

  • scale (float, optional) – Scale (i.e., multiply) the output values by this amount. 1.0 (default) results in no scaling of the output values.

  • offset (float, optional) – Offset (i.e., add to) the output values by this amount. This is applied after scaling. Let v be a resized and cropped value, then v * scale + offset is final output value. 0.0 (default) results in no offset being added to the output.

  • srcCast (bool, optional) – Boolean indicating whether or not the resize interpolation results are re-cast back to the input (or source) data type. Refer to the C API reference for more information. True (default) re-cast resize interpolation results back to the source data type.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.resizeCropConvertReformat(src: cvcuda.ImageBatchVarShape,

resize_dim: tuple[int,int],

interp: cvcuda.Interp, crop_rect: cvcuda.RectI, *, layout: str = “”, data_type: cvcuda.Type = 0, manip: cvcuda.ChannelManip = cvcuda.ChannelManip.NO_OP, scale: float = 1.0, offset: float = 0.0, srcCast: bool = True, stream: Optional[cvcuda.Stream] = None) -> cvcuda.Tensor

Executes the ResizeCropConvertReformat operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the ResizeCropConvertReformat operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images of varying sizes, but all images must have the same data type, channels, and layout.

  • resize_dim (tuple[int,int]) – Dimensions, width & height, of resized tensor (prior to cropping).

  • interp (cvcuda.Interp) – Interpolation type used for resizing. Currently, only cvcuda.Interp.NEAREST and cvcuda.Interp.LINEAR are available.

  • crop_rect (cvcuda.RectI) – Crop rectangle, (top, left, width, height), specifying the top-left corner and width & height dimensions of the region to crop from the resized images.

  • layout (string, optional) – String specifying output tensor layout (e.g., ‘NHWC’ or ‘CHW’). Empty string (default) indicates output tensor layout copies input.

  • data_type (cvcuda.Type, optional) – Data type of output tensor channel (e.g., uint8 or float). 0 (default) indicates output tensor data type copies input.

  • manip (cvcuda.ChannelManip, optional) – Channel manipulation (e.g., shuffle RGB to BGR). NO_OP (default) indicates output tensor channels are unchanged.

  • scale (float, optional) – Scale (i.e., multiply) the output values by this amount. 1.0 (default) results in no scaling of the output values.

  • offset (float, optional) – Offset (i.e., add to) the output values by this amount. This is applied after scaling. Let v be a resized and cropped value, then v * scale + offset is final output value. 0.0 (default) results in no offset being added to the output.

  • srcCast (bool, optional) – Boolean indicating whether or not the resize interpolation results are re-cast back to the input (or source) data type. Refer to the C API reference for more information. True (default) re-cast resize interpolation results back to the source data type.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.rotate(src: cvcuda.Tensor, angle_deg: float, shift: Tuple[float, float], interpolation: cvcuda.Interp, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Rotate operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Rotate operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • angle_deg (float) – Angle used for rotation in degrees.

  • shift (Tuple[float, float]) – Value of shift in {x, y} directions to move the center at the same coord after rotation.

  • interpolation (cvcuda.Interp) – Interpolation type used for transform.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.rotate(src: cvcuda.ImageBatchVarShape, angle_deg: float, shift: Tuple[float, float], interpolation: cvcuda.Interp, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Rotate operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Rotate operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • dst (cvcuda.ImageBatchVarShape) – Output image batch containing the result of the operation.

  • angle_deg (float) – Angle used for rotation in degrees for each image.

  • shift (Tuple[float, float]) – Value of shift in {x, y} directions to move the center at the same coord after rotation for each image.

  • interpolation (cvcuda.Interp) – Interpolation type used for transform.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.sift(src: cvcuda.Tensor, max_features: int = 0, num_octave_layers: int = 3, contrast_threshold: float = 0.029999999329447746, edge_threshold: float = 10.0, init_sigma: float = 1.600000023841858, flags: cvcuda.SIFT = <SIFT.USE_EXPANDED_INPUT: 1>, *, stream: Optional[cvcuda.Stream] = None) tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]

Executes the SIFT operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the SIFT operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor to extract features and compute descriptors from.

  • max_features (Number, optional) – Maximum number of features to be extracted, default is 5% of total pixels at a minimum of 1.

  • num_octave_layers (Number, optional) – Number of octave layers, default is 3.

  • contrast_threshold (Number, optional) – Contrast threshold, default is 0.03.

  • edge_threshold (Number, optional) – Edge threshold, default is 10.0.

  • init_sigma (Number, optional) – Initial sigma, default is 1.6.

  • flags (cvcuda.SIFT, optional) – Flag to whether to expand the input or not, default is cvcuda.SIFT.USE_EXPANDED_INPUT.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

A tuple with feature coordinates, metadata, descriptors and number of features.

Return type:

Tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.stack(src: list[cvcuda.Tensor], *, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Stack operation on the given cuda stream. This takes input tensors and combines them into a N(HWC/CHW) tensor.

See also

Refer to the CV-CUDA C API reference for the Stack operator for more details and usage examples.

Parameters:
  • src (List[cvcuda.Tensor]) – Input tensors containing one or more samples each images all tensors must be N(HWC/CHW) or HWC/CHW and have the same data type and shape.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor containing the stacked input tensors.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.threshold(src: cvcuda.Tensor, thresh: cvcuda.Tensor, maxval: cvcuda.Tensor, type: ThresholdType, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Threshold operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Threshold operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • thresh (cvcuda.Tensor) – An array of size batch that gives the threshold value of each image.

  • maxval (cvcuda.Tensor) – An array of size batch that gives the maxval value of each image, using with the cvcuda.ThresholdType.BINARY or cvcuda.ThresholdType.BINARY_INV threshold types.

  • type (cvcuda.ThresholdType) – Thresholding type.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.threshold(src: cvcuda.ImageBatchVarShape, thresh: cvcuda.Tensor, maxval: cvcuda.Tensor, type:ThresholdType, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Threshold operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Threshold operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • thresh (cvcuda.Tensor) – An array of size batch that gives the threshold value of each image.

  • maxval (cvcuda.Tensor) – An array of size batch that gives the maxval value of each image, using with the cvcuda.ThresholdType.BINARY or cvcuda.ThresholdType.BINARY_INV threshold types.

  • type (cvcuda.ThresholdType) – Thresholding type.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.warp_affine(src: cvcuda.Tensor, xform: cvcuda.Tensor, flags: cvcuda.Tensor, border_mode: cvcuda.Border = cvcuda.Border.CONSTANT, border_value: numpy.ndarray, stream: Optional[cvcuda.Stream] = None) cvcuda.Tensor

Executes the Warp Affine operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Warp Affine operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • xform (cvcuda.Tensor) – 2x3 float affine transformation matrix.

  • flags (int) – Combination of interpolation methods(cvcuda.Interp.NEAREST, cvcuda.Interp.LINEAR or cvcuda.Interp.CUBIC) and the optional flag cvcuda.Interp.WARP_INVERSE_MAP, that sets xform as the inverse transformation.

  • border_mode (cvcuda.Border, optional) – Pixel extrapolation method (cvcuda.Border.CONSTANT or cvcuda.Border.REPLICATE).

  • border_value (numpy.ndarray, optional) – Used to specify values for a constant border, must be a size <= 4 and dim of 1, where the values specify the border color for each color channel.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.warp_affine(src: cvcuda.ImageBatchVarShape, xform: cvcuda.Tensor, flags: cvcuda.Tensor, border_mode: cvcuda.Border = cvcuda.Border.CONSTANT, border_value: numpy.ndarray, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Warp Affine operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Warp Affine operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • xform (cvcuda.Tensor) – 2x3 float affine transformation matrix(s) for each image.

  • flags (int) – Combination of interpolation methods(cvcuda.Interp.NEAREST, cvcuda.Interp.LINEAR or cvcuda.Interp.CUBIC) and the optional flag cvcuda.Interp.WARP_INVERSE_MAP, that sets xform as the inverse transformation.

  • border_mode (cvcuda.Border, optional) – Pixel extrapolation method (cvcuda.Border.CONSTANT or cvcuda.Border.REPLICATE).

  • border_value (numpy.ndarray, optional) – Used to specify values for a constant border, must be a size <= 4 and dim of 1, where the values specify the border color for each color channel.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.warp_perspective(src: cvcuda.Tensor, xform: cvcuda.Tensor, flags: int, border_mode: cvcuda.Border, border_value: numpy.ndarray, stream: cvcuda.Stream | None = None) cvcuda.Tensor

Executes the Warp Perspective operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Warp Perspective operator for more details and usage examples.

Parameters:
  • src (cvcuda.Tensor) – Input tensor containing one or more images.

  • (numpy.ndarray (xform) – 3x3 perspective transformation matrix.

  • flags (int) – Combination of interpolation methods(cvcuda.Interp.NEAREST, cvcuda.Interp.LINEAR or cvcuda.Interp.CUBIC) and the optional flag cvcuda.Interp.WARP_INVERSE_MAP, that sets trans_matrix as the inverse transformation.

  • border_mode (cvcuda.Border) – pixel extrapolation method (cvcuda.Border.CONSTANT or cvcuda.Border.REPLICATE).

  • border_value (numpy.ndarray) – Used to specify values for a constant border, should be a size <= 4 and dim of 1, where the values specify the border color for each color channel.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output tensor.

Return type:

cvcuda.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.warp_perspective(src: cvcuda.ImageBatchVarShape, xform: cvcuda.Tensor, flags: int, border_mode: cvcuda.Border, border_value: numpy.ndarray, stream: Optional[cvcuda.Stream] = None) -> cvcuda.ImageBatchVarShape

Executes the Warp Perspective operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the Warp Perspective operator for more details and usage examples.

Parameters:
  • src (cvcuda.ImageBatchVarShape) – Input image batch containing one or more images.

  • xform (cvcuda.Tensor) – 3x3 perspective transformation matrix for each image in the batch.

  • flags (int) – Combination of interpolation methods(cvcuda.Interp.NEAREST, cvcuda.Interp.LINEAR or cvcuda.Interp.CUBIC) and the optional flag cvcuda.Interp.WARP_INVERSE_MAP, that sets trans_matrix as the inverse transformation.

  • border_mode (cvcuda.Border) – pixel extrapolation method (cvcuda.Border.CONSTANT or cvcuda.Border.REPLICATE).

  • border_value (numpy.ndarray) – Used to specify values for a constant border, must be a size <= 4 and dim of 1, where the values specify the border color for each color channel.

  • stream (cvcuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns:

The output image batch.

Return type:

cvcuda.ImageBatchVarShape

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.