pub struct FeaturePrint {
pub element_type: i32,
pub element_count: usize,
pub data: Vec<u8>,
}Available on crate feature
feature_print only.Expand description
A semantic image embedding produced by Apple’s vision pipeline.
Distances between two prints (e.g. cosine or L2) measure content similarity — useful for clustering, deduplication, and content-based image search.
Fields§
§element_type: i32Underlying element type — 1 = Float32, 2 = Float64.
element_count: usizeVector dimensionality.
data: Vec<u8>Raw element bytes (length = element_count * 4 or * 8).
Implementations§
Source§impl FeaturePrint
impl FeaturePrint
Sourcepub fn as_f32(&self) -> Option<Vec<f32>>
pub fn as_f32(&self) -> Option<Vec<f32>>
Decode the vector as f32 (only valid when
element_type == 1).
Sourcepub fn as_f64(&self) -> Option<Vec<f64>>
pub fn as_f64(&self) -> Option<Vec<f64>>
Decode the vector as f64 (only valid when
element_type == 2).
Sourcepub fn l2_distance(&self, other: &Self) -> Result<f64, VisionError>
pub fn l2_distance(&self, other: &Self) -> Result<f64, VisionError>
Compute Euclidean (L2) distance to another print. Smaller = more similar.
§Errors
Returns VisionError::InvalidArgument if the two prints
have different element types or counts.
Trait Implementations§
Source§impl Clone for FeaturePrint
impl Clone for FeaturePrint
Source§fn clone(&self) -> FeaturePrint
fn clone(&self) -> FeaturePrint
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FeaturePrint
impl Debug for FeaturePrint
Source§impl PartialEq for FeaturePrint
impl PartialEq for FeaturePrint
Source§fn eq(&self, other: &FeaturePrint) -> bool
fn eq(&self, other: &FeaturePrint) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for FeaturePrint
Auto Trait Implementations§
impl Freeze for FeaturePrint
impl RefUnwindSafe for FeaturePrint
impl Send for FeaturePrint
impl Sync for FeaturePrint
impl Unpin for FeaturePrint
impl UnsafeUnpin for FeaturePrint
impl UnwindSafe for FeaturePrint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more