Examples
The Iris repository includes several complete examples showcasing key capabilities of the library. Browse the Examples Overview for full source code and descriptions.
Running Examples
bash
# Clone the repository
git clone https://github.com/muhammad-fiaz/iris-cv.git
cd iris-cv
# Run any example with the wgpu backend
cargo run --example <name> --features wgpuTIP
Generate test assets first: cargo run --example generate_assets --features wgpu
Available Examples
Image Processing
| Example | Command | Description |
|---|---|---|
| Image Loading | cargo run --example image_loading --features wgpu | Load, resize, annotate, and save images |
| Filters | cargo run --example filters --features wgpu | Box, Gaussian, median, bilateral, and separable filters |
| Canny | cargo run --example canny --features wgpu | Canny edge detection on real images |
| Morphology | cargo run --example morphology --features wgpu | Dilation, erosion, opening, closing |
| Threshold | cargo run --example threshold --features wgpu | Binary, truncation, to-zero, Otsu thresholding |
| Contours | cargo run --example contours --features wgpu | Contour detection, convex hull, moments |
| Drawing | cargo run --example drawing --features wgpu | Lines, rectangles, circles, text |
Color & Photo
| Example | Command | Description |
|---|---|---|
| Color Processing | cargo run --example color_processing --features wgpu | Color space conversions, CLAHE, in-range |
| Photo Processing | cargo run --example photo_processing --features wgpu | NLM denoising and Mertens exposure fusion |
Features & Tracking
| Example | Command | Description |
|---|---|---|
| Optical Flow | cargo run --example optical_flow --features wgpu | Dense (Farneback) and sparse (Lucas-Kanade) flow |
| Tracking | cargo run --example tracking --features wgpu | Background subtraction and CSRT tracking |
Video
| Example | Command | Description |
|---|---|---|
| GIF Video | cargo run --example gif_video --features wgpu | GIF creation, reading, roundtrip |
| Video Processing | cargo run --example video_processing --features wgpu | Video writing and frame iteration |
| Video Frame Ops | cargo run --example video_frame_ops --features wgpu | Frame differencing, motion, batch, seeking |
| Video Metadata | cargo run --example video_metadata --features wgpu | Format detection, stream info, pixel formats |
| Image Sequence | cargo run --example image_sequence --features wgpu | Load numbered images into frames |
Detection & Recognition
| Example | Command | Description |
|---|---|---|
| Barcode Detection | cargo run --example barcode_detection --features wgpu | Barcode detection and decoding |
| QR Detection | cargo run --example qr_detection --features wgpu | QR code detection and decoding |
| ArUco Pose | cargo run --example aruco_pose --features wgpu | ArUco marker detection and pose estimation |
| Face Recognition | cargo run --example face_recognition --features wgpu | Face detection and recognition embeddings |
| Segmentation | cargo run --example segmentation --features wgpu | Semantic segmentation and connected components |
DNN & ML
| Example | Command | Description |
|---|---|---|
| ONNX Inference | cargo run --example onnx_inference --features wgpu | ONNX model loading and inference |
| SafeTensors Loading | cargo run --example safetensors_loading --features wgpu | Weight loading and NMS |
| K-Means Clustering | cargo run --example kmeans_clustering --features wgpu | K-Means clustering on 2D points |
| OCR | cargo run --example ocr --features wgpu | OCR text recognition pipeline |
Advanced
| Example | Command | Description |
|---|---|---|
| Stitching | cargo run --example stitching --features wgpu | Image panorama stitching |
| Camera Calibration | cargo run --example camera_calibration --features wgpu | Camera calibration, projection, homography |
| API Showcase | cargo run --example api_showcase --features wgpu | Core API overview |
| Image Utils | cargo run --example image_utils --features wgpu | Utility ops (filter2D, blend, LUT, noise) |
| GUI Windows | cargo run --example gui_windows --features wgpu | GUI windows, trackbars, mouse callbacks |
| Generate Assets | cargo run --example generate_assets --features wgpu | Generate test images for examples |