Skip to main content

apple_vision/
lib.rs

1#![doc = include_str!("../README.md")]
2//!
3//! ---
4//!
5//! # API Documentation
6//!
7//! Safe Rust bindings for Apple's
8//! [Vision](https://developer.apple.com/documentation/vision) framework —
9//! OCR, object detection, face landmarks, and other on-device computer
10//! vision tasks.
11//!
12//! v0.1 ships text recognition (OCR) only. Object/face detection lands
13//! in v0.2.
14
15#![cfg_attr(docsrs, feature(doc_cfg))]
16
17pub mod error;
18pub mod ffi;
19
20#[cfg(feature = "recognize_text")]
21#[cfg_attr(docsrs, doc(cfg(feature = "recognize_text")))]
22pub mod recognize_text;
23
24#[cfg(feature = "detect_faces")]
25#[cfg_attr(docsrs, doc(cfg(feature = "detect_faces")))]
26pub mod detect_faces;
27
28#[cfg(feature = "detect_barcodes")]
29#[cfg_attr(docsrs, doc(cfg(feature = "detect_barcodes")))]
30pub mod detect_barcodes;
31
32#[cfg(feature = "saliency")]
33#[cfg_attr(docsrs, doc(cfg(feature = "saliency")))]
34pub mod saliency;
35
36#[cfg(feature = "face_landmarks")]
37#[cfg_attr(docsrs, doc(cfg(feature = "face_landmarks")))]
38pub mod face_landmarks;
39
40pub use error::VisionError;
41
42#[cfg(feature = "recognize_text")]
43pub use recognize_text::{BoundingBox, RecognitionLevel, RecognizedText, TextRecognizer};
44
45#[cfg(feature = "detect_faces")]
46pub use detect_faces::{DetectedFace, FaceDetector};
47
48#[cfg(feature = "detect_barcodes")]
49pub use detect_barcodes::{detect_barcodes_in_path, DetectedBarcode};
50
51#[cfg(feature = "saliency")]
52pub use saliency::{attention_saliency_in_path, SalientRegion};
53
54#[cfg(feature = "face_landmarks")]
55pub use face_landmarks::{detect_face_landmarks_in_path, FaceWithLandmarks, LandmarkPoint};
56
57/// Common imports.
58pub mod prelude {
59    #[cfg(feature = "detect_barcodes")]
60    pub use crate::detect_barcodes::{detect_barcodes_in_path, DetectedBarcode};
61    #[cfg(feature = "detect_faces")]
62    pub use crate::detect_faces::{DetectedFace, FaceDetector};
63    pub use crate::error::VisionError;
64    #[cfg(feature = "face_landmarks")]
65    pub use crate::face_landmarks::{
66        detect_face_landmarks_in_path, FaceWithLandmarks, LandmarkPoint,
67    };
68    #[cfg(feature = "recognize_text")]
69    pub use crate::recognize_text::{
70        BoundingBox, RecognitionLevel, RecognizedText, TextRecognizer,
71    };
72    #[cfg(feature = "saliency")]
73    pub use crate::saliency::{attention_saliency_in_path, SalientRegion};
74}