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
56pub use error::VisionError;
57
58#[cfg(feature = "recognize_text")]
59pub use recognize_text::{BoundingBox, RecognitionLevel, RecognizedText, TextRecognizer};
60
61#[cfg(feature = "detect_faces")]
62pub use detect_faces::{DetectedFace, FaceDetector};
63
64#[cfg(feature = "detect_barcodes")]
65pub use detect_barcodes::{detect_barcodes_in_path, DetectedBarcode};
66
67#[cfg(feature = "saliency")]
68pub use saliency::{attention_saliency_in_path, SalientRegion};
69
70#[cfg(feature = "face_landmarks")]
71pub use face_landmarks::{detect_face_landmarks_in_path, FaceWithLandmarks, LandmarkPoint};
72
73#[cfg(feature = "body_pose")]
74pub use body_pose::{detect_human_body_pose_in_path, DetectedBodyPose, JointPoint};
75
76#[cfg(feature = "hand_pose")]
77pub use hand_pose::{detect_human_hand_pose_in_path, DetectedHandPose};
78
79#[cfg(feature = "contours")]
80pub use contours::{detect_contours_in_path, Contour, ContourOptions};
81
82#[cfg(feature = "animals")]
83pub use animals::{recognize_animals_in_path, RecognizedAnimal};
84
85/// Common imports.
86pub mod prelude {
87    #[cfg(feature = "animals")]
88    pub use crate::animals::{recognize_animals_in_path, RecognizedAnimal};
89    #[cfg(feature = "body_pose")]
90    pub use crate::body_pose::{detect_human_body_pose_in_path, DetectedBodyPose, JointPoint};
91    #[cfg(feature = "contours")]
92    pub use crate::contours::{detect_contours_in_path, Contour, ContourOptions};
93    #[cfg(feature = "detect_barcodes")]
94    pub use crate::detect_barcodes::{detect_barcodes_in_path, DetectedBarcode};
95    #[cfg(feature = "detect_faces")]
96    pub use crate::detect_faces::{DetectedFace, FaceDetector};
97    pub use crate::error::VisionError;
98    #[cfg(feature = "face_landmarks")]
99    pub use crate::face_landmarks::{
100        detect_face_landmarks_in_path, FaceWithLandmarks, LandmarkPoint,
101    };
102    #[cfg(feature = "hand_pose")]
103    pub use crate::hand_pose::{detect_human_hand_pose_in_path, DetectedHandPose};
104    #[cfg(feature = "recognize_text")]
105    pub use crate::recognize_text::{
106        BoundingBox, RecognitionLevel, RecognizedText, TextRecognizer,
107    };
108    #[cfg(feature = "saliency")]
109    pub use crate::saliency::{attention_saliency_in_path, SalientRegion};
110}