Expand description
Safe Rust wrappers for CV-CUDA (NVCV) — GPU computer-vision primitives.
CV-CUDA is a separately-installed NVIDIA library; this crate wraps the C API surface (not the C++ one). The workhorses are:
Resize— bilinear / cubic / area resampling.CvtColor— OpenCV-style colorspace conversion (BGR ↔ RGB ↔ YUV ↔ HSV ↔ grayscale).ConvertTo— dtype reinterpretation withalpha * x + beta.Flip— flip along one or both axes.Normalize—(x - base) * scale + shiftwith optional epsilon (ML normalization).
NVCV tensors are constructed via Tensor::new and reference-counted
under the hood; Rust wrappers release their ref on drop.
Modules§
- NVCV
Adaptive Threshold Type NVCVAdaptiveThresholdTypemodule.- NVCV
Border Type NVCVBorderTypemodule.- NVCV
Color Conversion Code NVCVColorConversionCode— opencv-style color conversion selector. Subset — full enum has ~200 values.- NVCV
Morphology Type NVCVMorphologyTypemodule.- NVCV
Threshold Type NVCVThresholdTypemodule.
Structs§
- Adaptive
Threshold - Adaptive threshold operator.
- AddWeighted
out = α * in1 + β * in2 + γwith saturation.- AdvCvt
Color - Advanced colour-space conversion (
code+ per-framespec). - Average
Blur - Box / average blur.
- Bilateral
Filter - Bilateral (edge-preserving) filter.
- BndBox
- Draw bounding boxes on the output image.
- BoxFilter
- Unnormalized box filter.
- Brightness
Contrast - Per-channel brightness + contrast adjustment.
- Canny
- Canny edge detector.
- Center
Crop - Center-crop to a target size.
- Channel
Reorder - Reorder output channels (e.g. BGR→RGB swap).
- Color
Twist - Apply a 3×4 / 4×4 color-transform matrix.
- Composite
- Alpha-mask compositing (
out = fg * mask + bg * (1 - mask)). - Conv2D
- 2D convolution with a user-supplied kernel.
- Convert
To - Convert-to operator (
output = alpha * input + beta, with dtype change). - Copy
Make Border - Constant / reflect / replicate border around
input. - Crop
Flip Normalize Reformat - Fused crop + flip + normalize + layout-reformat — the classic ML video-preproc bundle.
- Custom
Crop - Arbitrary-rect crop.
- CvtColor
- Color-conversion operator.
- Erase
- Erase rectangular regions (random or fixed content).
- Find
Contours - Find contours of binary regions.
- Flip
- Flip operator.
flip_code: 0 = vertical, 1 = horizontal, -1 = both. - Gamma
Contrast - Gamma-correction operator.
- Gaussian
- Separable Gaussian blur.
- Gaussian
Noise - Gaussian noise.
- Guided
Filter - Guided filter — edge-preserving filter that uses
guideto steer smoothing ofinput. - HQResize
- High-quality resize for ML preprocessing (separable with anti-aliasing).
- Hausdorff
Distance - Hausdorff distance between two point sets.
- Histogram
- Compute per-channel histograms.
- Histogram
Eq - Histogram equalization.
- Inpaint
- Mask-based inpainting.
- Joint
Bilateral Filter - Joint bilateral filter — uses a guide image’s edges to preserve structure while smoothing the primary input.
- Label
- Connected-component labeling.
- Laplacian
- Laplacian edge filter.
- Median
Blur - Median blur.
- MinArea
Rect - Minimum-area rectangle around each contour.
- MinMax
Loc - Find min/max values + locations in a tensor.
- Morphology
- Erosion / dilation / open / close.
- Motion
Blur - Directional motion blur.
- NVCV
Float2 NVCVFloat2(FFI binding).- NVCV
Size2D NVCVSize2D(FFI binding).- NonMax
Suppression - Non-maximum suppression over detection boxes + scores.
- Normalize
- Normalize operator (ML pre-processing:
(x - base) * scale+ tweaks). - Osd
- On-screen display — draw arbitrary text/line/rect overlays.
- Pad
- Pad an image by
top/leftborder amounts. - PadAnd
Stack - PadAndStack — pad a VarShape batch into a fixed-shape tensor.
- Pairwise
Matcher - Pairwise feature-descriptor matcher (e.g. for SIFT output).
- Pillow
Resize - Pillow-style high-quality resize.
- Random
Resized Crop - Random-resized-crop — the PyTorch-style augmentation.
- Reformat
- Reformat layout (e.g. NHWC → NCHW).
- Remap
- Remap by sampling a pixel-offset map (optical-flow, undistort).
- Resize
- Resize operator. Reusable across submissions.
- Resize
Crop Convert Reformat - Fused resize + crop + dtype-convert + layout-reformat.
- Resize
VarShape - Resize on a variable-shape image batch (different sizes per item).
- Rhomboid
Noise - Rhomboid noise.
- Rotate
- Rotate around image center by an angle in degrees.
- Rotate
Batch - Per-frame rotation of a batch tensor.
- Salt
AndPepper Noise - Salt-and-pepper noise.
- Sift
- SIFT — scale-invariant feature transform keypoint extractor.
- Stack
- Stack a VarShape image batch into a single tensor.
- Tensor
- An NVCV tensor handle. Drop releases the ref.
- Threshold
- Threshold operator (binary / trunc / tozero / Otsu / triangle).
- Warp
Affine - 2×3 affine warp (
output = input @ M). - Warp
Affine Batch - Per-frame 2×3 affine warp across a batch tensor.
- Warp
Perspective - 3×3 perspective (projective) warp.
Enums§
- Interpolation
- Interpolation selector for resampling operators.
Functions§
- probe
- Verify CV-CUDA is loadable on this host.