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
76#[cfg(feature = "aesthetics")]
77#[cfg_attr(docsrs, doc(cfg(feature = "aesthetics")))]
78pub mod aesthetics;
79
80pub use error::VisionError;
81
82#[cfg(feature = "recognize_text")]
83pub use recognize_text::{BoundingBox, RecognitionLevel, RecognizedText, TextRecognizer};
84
85#[cfg(feature = "detect_faces")]
86pub use detect_faces::{DetectedFace, FaceDetector};
87
88#[cfg(feature = "detect_barcodes")]
89pub use detect_barcodes::{detect_barcodes_in_path, DetectedBarcode};
90
91#[cfg(feature = "saliency")]
92pub use saliency::{attention_saliency_in_path, SalientRegion};
93
94#[cfg(feature = "face_landmarks")]
95pub use face_landmarks::{detect_face_landmarks_in_path, FaceWithLandmarks, LandmarkPoint};
96
97#[cfg(feature = "body_pose")]
98pub use body_pose::{detect_human_body_pose_in_path, DetectedBodyPose, JointPoint};
99
100#[cfg(feature = "hand_pose")]
101pub use hand_pose::{detect_human_hand_pose_in_path, DetectedHandPose};
102
103#[cfg(feature = "contours")]
104pub use contours::{detect_contours_in_path, Contour, ContourOptions};
105
106#[cfg(feature = "animals")]
107pub use animals::{recognize_animals_in_path, RecognizedAnimal};
108
109#[cfg(feature = "classify")]
110pub use classify::{classify_image_in_path, Classification};
111
112#[cfg(feature = "rectangles")]
113pub use rectangles::{
114    detect_document_segmentation_in_path, detect_rectangles_in_path, RectangleObservation,
115    RectangleOptions,
116};
117
118#[cfg(feature = "horizon")]
119pub use horizon::detect_horizon_in_path;
120
121#[cfg(feature = "feature_print")]
122pub use feature_print::{generate_image_feature_print_in_path, FeaturePrint};
123
124#[cfg(feature = "humans")]
125pub use humans::{detect_human_rectangles_in_path, DetectedHuman};
126
127#[cfg(feature = "aesthetics")]
128pub use aesthetics::{
129    calculate_aesthetics_scores_in_path, detect_face_capture_quality_in_path,
130    AestheticsScores, FaceCaptureQuality,
131};
132
133/// Common imports.
134pub mod prelude {
135    #[cfg(feature = "animals")]
136    pub use crate::animals::{recognize_animals_in_path, RecognizedAnimal};
137    #[cfg(feature = "body_pose")]
138    pub use crate::body_pose::{detect_human_body_pose_in_path, DetectedBodyPose, JointPoint};
139    #[cfg(feature = "classify")]
140    pub use crate::classify::{classify_image_in_path, Classification};
141    #[cfg(feature = "contours")]
142    pub use crate::contours::{detect_contours_in_path, Contour, ContourOptions};
143    #[cfg(feature = "detect_barcodes")]
144    pub use crate::detect_barcodes::{detect_barcodes_in_path, DetectedBarcode};
145    #[cfg(feature = "detect_faces")]
146    pub use crate::detect_faces::{DetectedFace, FaceDetector};
147    pub use crate::error::VisionError;
148    #[cfg(feature = "face_landmarks")]
149    pub use crate::face_landmarks::{
150        detect_face_landmarks_in_path, FaceWithLandmarks, LandmarkPoint,
151    };
152    #[cfg(feature = "feature_print")]
153    pub use crate::feature_print::{generate_image_feature_print_in_path, FeaturePrint};
154    #[cfg(feature = "hand_pose")]
155    pub use crate::hand_pose::{detect_human_hand_pose_in_path, DetectedHandPose};
156    #[cfg(feature = "horizon")]
157    pub use crate::horizon::detect_horizon_in_path;
158    #[cfg(feature = "humans")]
159    pub use crate::humans::{detect_human_rectangles_in_path, DetectedHuman};
160    #[cfg(feature = "rectangles")]
161    pub use crate::rectangles::{
162        detect_document_segmentation_in_path, detect_rectangles_in_path, RectangleObservation,
163        RectangleOptions,
164    };
165    #[cfg(feature = "recognize_text")]
166    pub use crate::recognize_text::{
167        BoundingBox, RecognitionLevel, RecognizedText, TextRecognizer,
168    };
169    #[cfg(feature = "saliency")]
170    pub use crate::saliency::{attention_saliency_in_path, SalientRegion};
171}