Expand description
§vision
Safe Rust bindings for Apple’s Vision framework — on-device OCR, object detection, face landmarks, and other computer vision tasks on macOS.
Status: experimental. v0.1 ships text recognition (OCR); object/face detection, classification, barcode scanning land in v0.2.
§Quick start — OCR
use apple_vision::prelude::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let recognizer = TextRecognizer::new()
.with_recognition_level(RecognitionLevel::Accurate)
.with_language_correction(true);
let observations = recognizer.recognize_in_path("/tmp/screenshot.png")?;
for obs in &observations {
println!("[{:.2}] '{}'", obs.confidence, obs.text);
}
Ok(())
}§Composes with the rest of the doom-fish stack
screencapturekit-rs / capture ──► IOSurface / PNG ──► vision ──► text
│
▼
foundation-models
("summarise this")§Feature flags
| Feature | Status |
|---|---|
recognize_text (default) | ✅ |
detect_faces (default) | ✅ |
detect_rectangles | 🚧 v0.4 |
classify_image | 🚧 v0.4 |
detect_barcodes | 🚧 v0.4 |
§Roadmap
-
VNRecognizeTextRequest(OCR) viaTextRecognizer -
VNDetectFaceRectanglesRequestviaFaceDetector(returns bounding box + roll/yaw/pitch) -
CGImage/CVPixelBufferingest (file path AND zero-copyCVPixelBufferpaths) -
VNDetectFaceLandmarksRequest(face landmark points) -
VNDetectRectanglesRequest -
VNClassifyImageRequest -
VNDetectBarcodesRequest -
Async API (
VNRequestcompletion handlers exposed viaasync fn)
§License
Licensed under either of Apache-2.0 or MIT at your option.
§API Documentation
Safe Rust bindings for Apple’s Vision framework — OCR, object detection, face landmarks, and other on-device computer vision tasks.
v0.1 ships text recognition (OCR) only. Object/face detection lands in v0.2.
Re-exports§
pub use error::VisionError;pub use recognize_text::BoundingBox;recognize_textpub use recognize_text::RecognitionLevel;recognize_textpub use recognize_text::RecognizedText;recognize_textpub use recognize_text::TextRecognizer;recognize_textpub use detect_faces::DetectedFace;detect_facespub use detect_faces::FaceDetector;detect_facespub use detect_barcodes::detect_barcodes_in_path;detect_barcodespub use detect_barcodes::DetectedBarcode;detect_barcodes
Modules§
- detect_
barcodes detect_barcodes - Barcode detection via
VNDetectBarcodesRequest(Vision v0.4). - detect_
faces detect_faces FaceDetector— wrapsVNDetectFaceRectanglesRequest.- error
- Errors from the Vision bridge.
- ffi
- Raw FFI declarations matching the Swift bridge in
swift-bridge/Sources/VisionBridge/Vision.swift. - prelude
- Common imports.
- recognize_
text recognize_text TextRecognizer— wrapsVNRecognizeTextRequestfor image-file OCR.