Data Types
- class cvcuda.Image
- cpu(self: cvcuda.Image, layout: cvcuda.TensorLayout | None = None) object
The image on the CPU
- cuda(self: cvcuda.Image, layout: cvcuda.TensorLayout | None = None) object
The image on the CUDA device
- property format
Read-only property that returns the format of the image
- property height
Read-only property that returns the height of the image
- property size
Read-only property that returns the size of the image
- property width
Read-only property that returns the width of the image
- static zeros(size: tuple[SupportsInt | SupportsIndex, SupportsInt | SupportsIndex], format: cvcuda.Format, rowalign: SupportsInt | SupportsIndex = 0) cvcuda.Image
Create an image filled with zeros with a given size, format and optional row align
- class cvcuda.Tensor
- cuda(self: cvcuda.Tensor) object
Reference to the Tensor on the CUDA device.
- property dtype
The data type of the Tensor.
- property layout
The TensorLayout of the Tensor.
- property ndim
The number of dimensions of the Tensor.
- reshape(self: cvcuda.Tensor, shape: tuple, layout: cvcuda.TensorLayout | None = None) cvcuda.Tensor
Produces a tensor pointing to the same data but with a new shape and layout.
- property shape
The shape of the Tensor.
- class cvcuda.ImageBatchVarShape
Batch of Images.
- property capacity
Return the capacity of the ImageBatchVarShape in number of images.
- clear(self: cvcuda.ImageBatchVarShape) None
Remove all images from the ImageBatchVarShape.
- property maxsize
Return the maximum size of the ImageBatchVarShape in bytes.
- popback(self: cvcuda.ImageBatchVarShape, count: SupportsInt | SupportsIndex = 1) None
Remove one or more images from the end of the ImageBatchVarShape.
- pushback(*args, **kwargs)
Overloaded function.
pushback(self: cvcuda.ImageBatchVarShape, arg0: cvcuda.Image) -> None
Add a new image to the end of the ImageBatchVarShape.
pushback(self: cvcuda.ImageBatchVarShape, arg0: collections.abc.Sequence[cvcuda.Image]) -> None
Add multiple images to the end of the ImageBatchVarShape.
- property uniqueformat
Return True if all the images have the same format, False otherwise.
- class cvcuda.TensorBatch
Container for a batch of tensors. The capacity of the container must be specified upfront in the batch initialization. The tensors in the batch may differ in shapes but they must have a uniform dimensionality, data type and layout.
- property capacity
Capacity of the tensor batch.
- clear(self: cvcuda.TensorBatch) None
Remove all images from the TensorBatch.
- property dtype
Data type of tensors in the tensor batch. None if the batch is empty.
- property layout
Layout of the tensors in the tensor batch. None if the batch is empty.
- property ndim
Return the number of dimensions of the tensors or -1 for an empty batch
- popback(self: cvcuda.TensorBatch, count: SupportsInt | SupportsIndex = 1) None
Remove one or more images from the end of the TensorBatch.
- pushback(*args, **kwargs)
Overloaded function.
pushback(self: cvcuda.TensorBatch, arg0: cvcuda.Tensor) -> None
Add a new image to the end of the TensorBatch.
pushback(self: cvcuda.TensorBatch, arg0: collections.abc.Sequence[cvcuda.Tensor]) -> None
Add multiple images to the end of the TensorBatch.
- class cvcuda.Format
Members:
_2S16
_2S16_BL
_2F16
_2F32
_2C64
_2C128
U8
U8_BL
S8
U16
U32
S32
S16
S16_BL
F16
F32
F64
C64
C128
Y8
Y8_BL
Y8_ER
Y8_ER_BL
Y16
Y16_BL
Y16_ER
Y16_ER_BL
NV12
NV12_BL
NV12_ER
NV12_ER_BL
NV21
NV21_ER
NV24
NV24_BL
NV24_ER
NV24_ER_BL
UYVY
UYVY_BL
UYVY_ER
UYVY_ER_BL
VYUY
VYUY_BL
VYUY_ER
VYUY_ER_BL
YUYV
YUYV_BL
YUYV_ER
YUYV_ER_BL
YUV8p
YUV8p_ER
RGB8
BGR8
RGBA8
BGRA8
RGB8p
BGR8p
RGBA8p
BGRA8p
RGBf16
BGRf16
RGBAf16
BGRAf16
RGBf16p
BGRf16p
RGBAf16p
BGRAf16p
RGBf32
BGRf32
RGBAf32
BGRAf32
RGBf32p
BGRf32p
RGBAf32p
BGRAf32p
HSV8
LAB8
LAB8p
LABf16
LABf16p
LABf32
LABf32p
CMYK8
YCCK8
RGBA8_UNASSOCIATED_ALPHA
RGB8_1U_U8
RGB8_7U_U8
RGBA8_3U_U16
RGBA8_3POS3D_U32
RGB8_3D_F32
NONE
- BGR8 = nvcv.Format.BGR8
- BGR8p = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,UNSIGNED,ZYX1,ASSOCIATED,X8,X8,X8)>
- BGRA8 = nvcv.Format.BGRA8
- BGRA8p = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,UNSIGNED,ZYXW,ASSOCIATED,X8,X8,X8,X8)>
- BGRAf16 = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,FLOAT,ZYXW,ASSOCIATED,X16_Y16_Z16_W16)>
- BGRAf16p = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,FLOAT,ZYXW,ASSOCIATED,X16,X16,X16,X16)>
- BGRAf32 = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,FLOAT,ZYXW,ASSOCIATED,X32_Y32_Z32_W32)>
- BGRAf32p = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,FLOAT,ZYXW,ASSOCIATED,X32,X32,X32,X32)>
- BGRf16 = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,FLOAT,ZYX1,ASSOCIATED,X16_Y16_Z16)>
- BGRf16p = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,FLOAT,ZYX1,ASSOCIATED,X16,X16,X16)>
- BGRf32 = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,FLOAT,ZYX1,ASSOCIATED,X32_Y32_Z32)>
- BGRf32p = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,FLOAT,ZYX1,ASSOCIATED,X32,X32,X32)>
- C128 = nvcv.Format.C128
- C64 = nvcv.Format.C64
- CMYK8 = nvcv.Format.CMYK8
- F16 = nvcv.<Unknown image format: NVCVImageFormat(UNDEFINED,PITCH_LINEAR,FLOAT,X000,ASSOCIATED,X16)>
- F32 = nvcv.Format.F32
- F64 = nvcv.Format.F64
- HSV8 = nvcv.Format.HSV8
- LAB8 = nvcv.Format.LAB8
- LAB8p = nvcv.Format.LAB8p
- LABf16 = nvcv.Format.LABf16
- LABf16p = nvcv.Format.LABf16p
- LABf32 = nvcv.Format.LABf32
- LABf32p = nvcv.Format.LABf32p
- NONE = nvcv.Format.NONE
- NV12 = nvcv.Format.NV12
- NV12_BL = nvcv.Format.NV12_BL
- NV12_ER = nvcv.Format.NV12_ER
- NV12_ER_BL = nvcv.Format.NV12_ER_BL
- NV21 = nvcv.Format.NV12
- NV21_ER = nvcv.Format.NV12_ER
- NV24 = nvcv.Format.NV24
- NV24_BL = nvcv.Format.NV24_BL
- NV24_ER = nvcv.Format.NV24_ER
- NV24_ER_BL = nvcv.Format.NV24_ER_BL
- RGB8 = nvcv.Format.RGB8
- RGB8_1U_U8 = nvcv.Format.RGB8_1U_U8
- RGB8_3D_F32 = nvcv.Format.RGB8_3D_F32
- RGB8_7U_U8 = nvcv.Format.RGB8_7U_U8
- RGB8p = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,UNSIGNED,XYZ0,ASSOCIATED,X8,X8,X8)>
- RGBA8 = nvcv.Format.RGBA8
- RGBA8_3POS3D_U32 = nvcv.Format.RGBA8_3POS3D_U32
- RGBA8_3U_U16 = nvcv.Format.RGBA8_3U_U16
- RGBA8_UNASSOCIATED_ALPHA = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,UNSIGNED,XYZW,UNASSOCIATED,X8_Y8_Z8_W8)>
- RGBA8p = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,UNSIGNED,XYZW,ASSOCIATED,X8,X8,X8,X8)>
- RGBAf16 = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,FLOAT,XYZW,ASSOCIATED,X16_Y16_Z16_W16)>
- RGBAf16p = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,FLOAT,XYZW,ASSOCIATED,X16,X16,X16,X16)>
- RGBAf32 = nvcv.Format.RGBAf32
- RGBAf32p = nvcv.Format.RGBAf32p
- RGBf16 = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,FLOAT,XYZ1,ASSOCIATED,X16_Y16_Z16)>
- RGBf16p = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,FLOAT,XYZ0,ASSOCIATED,X16,X16,X16)>
- RGBf32 = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,FLOAT,XYZ1,ASSOCIATED,X32_Y32_Z32)>
- RGBf32p = nvcv.<Unknown image format: NVCVImageFormat(RGB,UNDEFINED,PITCH_LINEAR,FLOAT,XYZ0,ASSOCIATED,X32,X32,X32)>
- S16 = nvcv.Format.S16
- S16_BL = nvcv.Format.S16_BL
- S32 = nvcv.Format.S32
- S8 = nvcv.Format.S8
- U16 = nvcv.Format.U16
- U32 = nvcv.Format.U32
- U8 = nvcv.Format.U8
- U8_BL = nvcv.Format.U8_BL
- UYVY = nvcv.Format.UYVY
- UYVY_BL = nvcv.Format.UYVY_BL
- UYVY_ER = nvcv.Format.UYVY_ER
- UYVY_ER_BL = nvcv.Format.UYVY_ER_BL
- VYUY = nvcv.Format.VYUY
- VYUY_BL = nvcv.Format.VYUY_BL
- VYUY_ER = nvcv.Format.VYUY_ER
- VYUY_ER_BL = nvcv.Format.VYUY_ER_BL
- Y16 = nvcv.Format.Y16
- Y16_BL = nvcv.Format.Y16_BL
- Y16_ER = nvcv.Format.Y16_ER
- Y16_ER_BL = nvcv.Format.Y16_ER_BL
- Y8 = nvcv.Format.Y8
- Y8_BL = nvcv.Format.Y8_BL
- Y8_ER = nvcv.Format.Y8_ER
- Y8_ER_BL = nvcv.Format.Y8_ER_BL
- YCCK8 = nvcv.Format.YCCK8
- YUV8p = nvcv.Format.YUV8p
- YUV8p_ER = nvcv.Format.YUV8p_ER
- YUYV = nvcv.Format.YUYV
- YUYV_BL = nvcv.Format.YUYV_BL
- YUYV_ER = nvcv.Format.YUYV_ER
- YUYV_ER_BL = nvcv.Format.YUYV_ER_BL
- property channels
Read-only property that returns the number of color channels in the image
- property name
- property planes
Read-only property that returns the number of planes in the image
- property value
- class cvcuda.ColorSpec
Members:
BT601 : Color spec defining ITU-R BT.601 standard.
BT709 : Color spec defining ITU-R BT.709 standard.
BT2020 : Color spec defining ITU-R BT.2020 standard.
- BT2020 = <ColorSpec.BT2020: 21930>
- BT601 = <ColorSpec.BT601: 21665>
- BT709 = <ColorSpec.BT709: 21793>
- property name
- property value
- class cvcuda.TensorLayout
- C = C
- CDHW = CDHW
- CFDHW = CFDHW
- CFHW = CFHW
- CHW = CHW
- CW = CW
- D = D
- DHW = DHW
- DHWC = DHWC
- F = F
- FCDHW = FCDHW
- FCHW = FCHW
- FDHW = FDHW
- FDHWC = FDHWC
- FHW = FHW
- FHWC = FHWC
- H = H
- HW = HW
- HWC = HWC
- N = N
- NCDHW = NCDHW
- NCFDHW = NCFDHW
- NCFHW = NCFHW
- NCHW = NCHW
- NCW = NCW
- NDHW = NDHW
- NDHWC = NDHWC
- NFCDHW = NFCDHW
- NFCHW = NFCHW
- NFDHW = NFDHW
- NFDHWC = NFDHWC
- NFHW = NFHW
- NFHWC = NFHWC
- NHW = NHW
- NHWC = NHWC
- NONE
- NW = NW
- NWC = NWC
- W = W
- WC = WC
- class cvcuda.RectI
- property height
Height of the rectangle
- property width
Width of the rectangle
- property x
X coordinate of the rectangle’s top-left corner
- property y
Y coordinate of the rectangle’s top-left corner
- class cvcuda.Stream
A CUDA stream that cvcuda operators can be submitted to.
Streams created via
cvcuda.Stream()are non-blocking (cudaStreamNonBlocking) so they can run concurrently with CUDA’s legacy default stream and with other non-blocking streams.Cross-library stream safety is handled automatically via the CUDA Array Interface (CAI) v3
streamfield:On input,
cvcuda.as_tensor/cvcuda.as_imageread__cuda_array_interface__["stream"]from the producer (cupy, torch, jax, etc.) and arrange for the first cvcuda operator to insert the propercudaStreamWaitEventbefore reading the data. No user-sidesynchronize()call is required.On output, tensors returned by
cvcuda.Tensor.cuda()/cvcuda.Image.cuda()populate__cuda_array_interface__ ["stream"]with the cvcuda stream the data was last written on, so downstream consumers can sync themselves.
Advanced usage:
Opt out of the implicit wait: export your buffer with
stream: -1in its CAI dict to tell cvcuda you’ve already synchronized; the first op then runs without an extra event.Legacy default stream: if your producer uses v2 CAI (no
streamfield) or advertisesstream: 1, cvcuda waits on the legacy default stream. This is the safe conservative default but forfeits concurrency with stream-0 work.Use the default stream:
cvcuda.Stream.defaultwraps stream 0 and has the usual legacy-default blocking semantics; use it when you want implicit sync with everything else on stream 0 and don’t need the concurrency of a dedicated stream.
- property handle
Get the integer handle for the CUDA stream object.
- property id
Get the unique ID for the CUDA stream object.
- sync(self: cvcuda.Stream) None
Wait for all preceding CUDA calls in the current stream to complete.
- wait_stream(self: cvcuda.Stream, other: cvcuda.Stream) None
Insert a dependency on ‘other’ into this stream. All subsequent work enqueued on this stream will wait until all work currently enqueued on ‘other’ has completed. Calling wait_stream(self) is a no-op. Cross-device usage is not supported and will raise a CUDA error.
- class cvcuda.Resource
- property id
Unique resource instance identifier
- submitStreamSync(self: cvcuda.Resource, stream: cvcuda.Stream) None
Syncs object on new Stream
- class cvcuda.ExternalBuffer
- property dtype
Get the data type of the buffer
- property shape
Get the shape of the buffer as an array
- property strides
Get the strides of the buffer
- class cvcuda.Container
- class cvcuda.Elements