SciRS2 Vision
scirs2-vision is the computer vision crate for the SciRS2 scientific computing library. It provides comprehensive tools for feature detection, image segmentation, geometric transformations, stereo vision, 3D reconstruction, object detection, video processing, and camera calibration with APIs familiar to users of OpenCV and scikit-image.
What scirs2-vision Provides
Use scirs2-vision when you need to:
- Detect and match features in images (Harris corners, SIFT, ORB, FAST, HOG)
- Segment images with watershed, SLIC superpixels, instance segmentation, or panoptic segmentation
- Estimate camera pose (PnP), calibrate cameras, or work with stereo depth
- Process video frames: optical flow, video stabilization, frame extraction
- Build a 3D reconstruction pipeline (ICP, RANSAC-based registration)
- Perform object detection and face detection
- Apply style transfer or image quality enhancement
Features (v0.3.0)
Feature Detection and Description
- Edge Detection: Sobel, Canny, Prewitt, Laplacian, Laplacian of Gaussian (LoG)
- Corner Detection: Harris corners, Shi-Tomasi (Good Features to Track), FAST corners
- Blob Detection: Difference of Gaussians (DoG), LoG, MSER (Maximally Stable Extremal Regions)
- Keypoint Descriptors: SIFT (Scale-Invariant Feature Transform), ORB, BRIEF, HOG (Histogram of Oriented Gradients)
- Feature Matching: RANSAC-based robust matching, homography estimation
- Hough Transforms: Hough circle transform, Hough line transform
- Sub-pixel refinement: Corner refinement to sub-pixel accuracy
Image Segmentation
- Thresholding: Binary, Otsu's automatic, adaptive (mean/Gaussian)
- Region-Based: SLIC superpixels, watershed algorithm, region growing
- Instance Segmentation: Mask generation, per-instance labeling
- Panoptic Segmentation: Combined semantic and instance segmentation
- Interactive Segmentation: GrabCut-style foreground/background separation
- Advanced: Mean shift clustering, connected component analysis
Camera and 3D Vision
- Camera Calibration: Intrinsic parameter estimation, lens distortion correction
- Camera Models: Pinhole, fisheye, and generic camera models
- Stereo Depth Estimation: Disparity map computation, depth from stereo pairs
- PnP Pose Estimation: Perspective-n-Point solver for 6-DOF pose from 2D-3D correspondences
- SLAM Foundations: Feature tracking, map point management, loop closure detection
Point Cloud Processing
- ICP (Iterative Closest Point): Point cloud registration and alignment
- RANSAC Registration: Robust point cloud alignment with outlier rejection
- Point Cloud I/O: Load/save PLY, XYZ formats
- 3D Reconstruction Pipeline: Multi-view stereo foundations
Video Processing
- Frame Extraction: Extract frames from video streams
- Dense Optical Flow: Farneback algorithm, Lucas-Kanade dense flow
- Video Stabilization: Feature-based and mesh-based stabilization
- Motion Detection: Frame differencing, background subtraction
Object Detection
- Detection Framework: Bounding box prediction, Non-Maximum Suppression (NMS)
- Sliding Window: Multi-scale sliding window detector
- HOG+SVM Pedestrian Detection: Classical HOG-based detection pipeline
Face Detection
- Viola-Jones Foundation: Haar cascade evaluation
- Face Detection Pipeline: Multi-scale face candidate generation
Image Enhancement and Preprocessing
- Noise Reduction: Non-local means denoising, bilateral filtering, guided filtering
- Enhancement: Histogram equalization, CLAHE, gamma correction
- Filtering: Gaussian blur, median, unsharp masking
- Super-Resolution: Single-image super-resolution algorithms
Color Processing
- Color Space Conversions: RGB to/from HSV, LAB, YCbCr, grayscale
- Channel Operations: Splitting, merging, per-channel processing
- Color Quantization: K-means, median cut, octree quantization
- Color Normalization: Histogram matching, color transfer
Geometric Transformations
- Affine: Translation, rotation, scaling, shearing with multiple interpolation modes
- Perspective: Homography-based warping with robust estimation
- Non-Rigid: Thin-plate spline deformation, elastic transformations
- Interpolation Methods: Bilinear, bicubic, Lanczos, edge-preserving
Image Registration
- Feature-Based Registration: Using detected keypoints and RANSAC
- Intensity-Based Registration: Normalized cross-correlation, mutual information
- Supported Transforms: Rigid, similarity, affine, homography
Morphological Operations
- Erosion, dilation with customizable structuring elements
- Opening, closing, morphological gradient
- Top-hat, black-hat transforms
Style Transfer
- Neural style transfer interface
- Artistic stylization using statistical feature matching
Image Quality
- PSNR (Peak Signal-to-Noise Ratio)
- SSIM (Structural Similarity Index)
- Blind image quality assessment
Texture Analysis
- Gray-level co-occurrence matrix (GLCM)
- Local binary patterns (LBP)
- Gabor filters
- Tamura texture features
Medical Imaging
- DICOM-compatible array handling
- Frangi vesselness filter
- Bone enhancement filters
- Basic segmentation for medical images
Installation
[]
= "0.3.0"
For parallel processing:
[]
= { = "0.3.0", = ["parallel"] }
Quick Start
Feature Detection
use ;
use ;
use open;
Stereo Depth Estimation
use ;
use CoreResult;
Camera Pose Estimation (PnP)
use solve_pnp;
use CoreResult;
ICP Point Cloud Registration
use icp_registration;
use CoreResult;
Dense Optical Flow
use farneback_flow;
use image_to_array;
use open;
use CoreResult;
Instance Segmentation
use ;
use image_to_array;
use open;
use CoreResult;
Image Segmentation
use ;
use open;
Feature Flags
| Flag | Description |
|---|---|
parallel |
Enable Rayon-based multi-threaded processing |
Performance
- Parallel processing via Rayon for CPU-intensive operations
- SIMD-accelerated convolution kernels for filtering
- Memory-efficient streaming for video and large image sequences
- Benchmarked against OpenCV and scikit-image reference implementations
Documentation
Full API reference: docs.rs/scirs2-vision
Dependencies
scirs2-core: Core SciRS2 abstractions (error handling, array types, random)scirs2-ndimage: N-dimensional image processing primitivesimage: Rust image loading and format supportnum-traits,num-complex: Numerical type traits
License
Licensed under the Apache License 2.0. See LICENSE for details.