Skip to content

Examples

Run any example with:

bash
cargo run --example <name> --features wgpu

::: note All examples require the wgpu feature. Generate test assets first with cargo run --example generate_assets --features wgpu. :::

Image Processing

ExampleDescription
image_loadingLoad, resize, annotate, and save images
filtersBox, Gaussian, median, bilateral, and separable filters
cannyCanny edge detection on real images
morphologyDilation, erosion, opening, closing
thresholdBinary, truncation, to-zero, and Otsu thresholding
contoursContour detection, convex hull, moments
drawingDraw lines, rectangles, circles, and text

Color & Histogram

ExampleDescription
color_processingColor space conversions, CLAHE, in-range thresholding
photo_processingNLM denoising and Mertens exposure fusion

Features & Tracking

ExampleDescription
optical_flowDense (Farneback) and sparse (Lucas-Kanade) optical flow
trackingBackground subtraction and CSRT object tracking

Video

ExampleDescription
gif_videoGIF creation, reading, and roundtrip verification
video_processingVideo writing and frame iteration
video_frame_opsFrame differencing, motion, batch, seeking, looping
video_metadataFormat detection, stream info, pixel formats
image_sequenceLoad numbered image sequences into frames

Detection & Recognition

ExampleDescription
barcode_detectionBarcode detection and decoding
qr_detectionQR code detection and decoding
aruco_poseArUco marker detection and pose estimation
face_recognitionFace detection and recognition embeddings
segmentationSemantic segmentation and connected components

DNN & ML

ExampleDescription
onnx_inferenceONNX model loading and inference
safetensors_loadingWeight loading and NMS
kmeans_clusteringK-Means clustering on 2D points
ocrOCR text recognition pipeline

Advanced

ExampleDescription
stitchingImage panorama stitching
camera_calibrationCamera calibration, projection, homography
api_showcaseCore API overview (color, noise, filters, drawing)
image_utilsUtility ops (filter2D, blend, LUT, noise, histogram)
gui_windowsGUI windows, trackbars, mouse callbacks
generate_assetsGenerate test images for examples

Released under the MIT License.