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
40#[cfg(feature = "body_pose")]
41#[cfg_attr(docsrs, doc(cfg(feature = "body_pose")))]
42pub mod body_pose;
43
44#[cfg(feature = "hand_pose")]
45#[cfg_attr(docsrs, doc(cfg(feature = "hand_pose")))]
46pub mod hand_pose;
47
48#[cfg(feature = "contours")]
49#[cfg_attr(docsrs, doc(cfg(feature = "contours")))]
50pub mod contours;
51
52#[cfg(feature = "animals")]
53#[cfg_attr(docsrs, doc(cfg(feature = "animals")))]
54pub mod animals;
55
56#[cfg(feature = "classify")]
57#[cfg_attr(docsrs, doc(cfg(feature = "classify")))]
58pub mod classify;
59
60#[cfg(feature = "rectangles")]
61#[cfg_attr(docsrs, doc(cfg(feature = "rectangles")))]
62pub mod rectangles;
63
64#[cfg(feature = "horizon")]
65#[cfg_attr(docsrs, doc(cfg(feature = "horizon")))]
66pub mod horizon;
67
68#[cfg(feature = "feature_print")]
69#[cfg_attr(docsrs, doc(cfg(feature = "feature_print")))]
70pub mod feature_print;
71
72#[cfg(feature = "humans")]
73#[cfg_attr(docsrs, doc(cfg(feature = "humans")))]
74pub mod humans;
75
76pub use error::VisionError;
77
78#[cfg(feature = "recognize_text")]
79pub use recognize_text::{BoundingBox, RecognitionLevel, RecognizedText, TextRecognizer};
80
81#[cfg(feature = "detect_faces")]
82pub use detect_faces::{DetectedFace, FaceDetector};
83
84#[cfg(feature = "detect_barcodes")]
85pub use detect_barcodes::{detect_barcodes_in_path, DetectedBarcode};
86
87#[cfg(feature = "saliency")]
88pub use saliency::{attention_saliency_in_path, SalientRegion};
89
90#[cfg(feature = "face_landmarks")]
91pub use face_landmarks::{detect_face_landmarks_in_path, FaceWithLandmarks, LandmarkPoint};
92
93#[cfg(feature = "body_pose")]
94pub use body_pose::{detect_human_body_pose_in_path, DetectedBodyPose, JointPoint};
95
96#[cfg(feature = "hand_pose")]
97pub use hand_pose::{detect_human_hand_pose_in_path, DetectedHandPose};
98
99#[cfg(feature = "contours")]
100pub use contours::{detect_contours_in_path, Contour, ContourOptions};
101
102#[cfg(feature = "animals")]
103pub use animals::{recognize_animals_in_path, RecognizedAnimal};
104
105#[cfg(feature = "classify")]
106pub use classify::{classify_image_in_path, Classification};
107
108#[cfg(feature = "rectangles")]
109pub use rectangles::{
110    detect_document_segmentation_in_path, detect_rectangles_in_path, RectangleObservation,
111    RectangleOptions,
112};
113
114#[cfg(feature = "horizon")]
115pub use horizon::detect_horizon_in_path;
116
117#[cfg(feature = "feature_print")]
118pub use feature_print::{generate_image_feature_print_in_path, FeaturePrint};
119
120#[cfg(feature = "humans")]
121pub use humans::{detect_human_rectangles_in_path, DetectedHuman};
122
123/// Common imports.
124pub mod prelude {
125    #[cfg(feature = "animals")]
126    pub use crate::animals::{recognize_animals_in_path, RecognizedAnimal};
127    #[cfg(feature = "body_pose")]
128    pub use crate::body_pose::{detect_human_body_pose_in_path, DetectedBodyPose, JointPoint};
129    #[cfg(feature = "classify")]
130    pub use crate::classify::{classify_image_in_path, Classification};
131    #[cfg(feature = "contours")]
132    pub use crate::contours::{detect_contours_in_path, Contour, ContourOptions};
133    #[cfg(feature = "detect_barcodes")]
134    pub use crate::detect_barcodes::{detect_barcodes_in_path, DetectedBarcode};
135    #[cfg(feature = "detect_faces")]
136    pub use crate::detect_faces::{DetectedFace, FaceDetector};
137    pub use crate::error::VisionError;
138    #[cfg(feature = "face_landmarks")]
139    pub use crate::face_landmarks::{
140        detect_face_landmarks_in_path, FaceWithLandmarks, LandmarkPoint,
141    };
142    #[cfg(feature = "feature_print")]
143    pub use crate::feature_print::{generate_image_feature_print_in_path, FeaturePrint};
144    #[cfg(feature = "hand_pose")]
145    pub use crate::hand_pose::{detect_human_hand_pose_in_path, DetectedHandPose};
146    #[cfg(feature = "horizon")]
147    pub use crate::horizon::detect_horizon_in_path;
148    #[cfg(feature = "humans")]
149    pub use crate::humans::{detect_human_rectangles_in_path, DetectedHuman};
150    #[cfg(feature = "rectangles")]
151    pub use crate::rectangles::{
152        detect_document_segmentation_in_path, detect_rectangles_in_path, RectangleObservation,
153        RectangleOptions,
154    };
155    #[cfg(feature = "recognize_text")]
156    pub use crate::recognize_text::{
157        BoundingBox, RecognitionLevel, RecognizedText, TextRecognizer,
158    };
159    #[cfg(feature = "saliency")]
160    pub use crate::saliency::{attention_saliency_in_path, SalientRegion};
161}