Skip to main content

FeatureStore

Struct FeatureStore 

Source
pub struct FeatureStore { /* private fields */ }
Expand description

In-memory feature store.

Implementations§

Source§

impl FeatureStore

Source

pub fn new() -> Self

Empty store.

Source

pub fn add_camera(&self, camera: Camera) -> Result<CameraId>

Adds a camera. If camera_id is the invalid value, issues “max id + 1” (1 for an empty store).

Source

pub fn update_camera(&self, camera: Camera) -> Result<()>

Overwrites an existing camera (error if absent).

Source

pub fn camera(&self, id: CameraId) -> Option<Camera>

Camera lookup (copy).

Source

pub fn cameras(&self) -> Vec<Camera>

All cameras (in id order).

Source

pub fn num_cameras(&self) -> usize

Number of cameras.

Source

pub fn add_image(&self, name: &str, camera_id: CameraId) -> Result<ImageId>

Adds an image (name unique, camera must exist). The id is “max id + 1” (1 for an empty store).

Source

pub fn add_image_with_id( &self, image_id: ImageId, name: &str, camera_id: CameraId, ) -> Result<ImageId>

Adds an image with the given id.

Source

pub fn image(&self, id: ImageId) -> Option<StoreImage>

Image lookup.

Source

pub fn image_id_by_name(&self, name: &str) -> Option<ImageId>

Name -> image id.

Source

pub fn image_by_name(&self, name: &str) -> Option<StoreImage>

Looks up an image by name.

Source

pub fn images(&self) -> Vec<StoreImage>

All images (ascending by id).

Source

pub fn image_ids(&self) -> Vec<ImageId> ⓘ

List of image ids (ascending).

Source

pub fn num_images(&self) -> usize

Number of images.

Source

pub fn exists_image(&self, id: ImageId) -> bool

Whether the image exists.

Source

pub fn set_pose_prior(&self, image_id: ImageId, prior: PosePrior)

Sets the image prior position.

Source

pub fn pose_prior(&self, image_id: ImageId) -> Option<PosePrior>

Gets the image prior position.

Source

pub fn set_keypoints(&self, image_id: ImageId, kps: Vec<Keypoint>)

Writes keypoints (overwrites).

Source

pub fn set_descriptors(&self, image_id: ImageId, d: Descriptors)

Writes descriptors (overwrites).

Source

pub fn keypoints(&self, image_id: ImageId) -> Option<Arc<Vec<Keypoint>>>

Keypoint lookup (shared).

Source

pub fn descriptors(&self, image_id: ImageId) -> Option<Arc<Descriptors>>

Descriptor lookup (shared).

Source

pub fn exists_keypoints(&self, image_id: ImageId) -> bool

Whether keypoints exist.

Source

pub fn exists_descriptors(&self, image_id: ImageId) -> bool

Whether descriptors exist.

Source

pub fn num_keypoints(&self, image_id: ImageId) -> usize

Number of keypoints of the image (0 if absent).

Source

pub fn largest_keypoint_count(&self) -> usize

Maximum of the per-image keypoint counts.

Source

pub fn write_matches( &self, id1: ImageId, id2: ImageId, matches: &[FeatureMatch], ) -> Result<()>

Writes raw matches (overwrites). Takes index pairs in (id1, id2) order.

Source

pub fn read_matches( &self, id1: ImageId, id2: ImageId, ) -> Option<Arc<Vec<FeatureMatch>>>

Raw match lookup in the (id1, id2) direction.

Source

pub fn exists_matches(&self, id1: ImageId, id2: ImageId) -> bool

Whether raw matches exist.

Source

pub fn delete_matches(&self, id1: ImageId, id2: ImageId)

Deletes raw matches.

Source

pub fn put_two_view( &self, id1: ImageId, id2: ImageId, tvg: &TwoViewGeometry, ) -> Result<()>

Writes two-view geometry (overwrites). Takes geometry in the (id1 -> id2) direction.

Source

pub fn get_two_view( &self, id1: ImageId, id2: ImageId, ) -> Option<Arc<TwoViewGeometry>>

Two-view geometry in the (id1 -> id2) direction.

Source

pub fn contains_two_view(&self, id1: ImageId, id2: ImageId) -> bool

Whether two-view geometry exists.

Source

pub fn remove_two_view(&self, id1: ImageId, id2: ImageId)

Deletes two-view geometry.

Source

pub fn two_view_geometries(&self) -> Vec<(PairId, Arc<TwoViewGeometry>)>

All stored two-view geometries (ascending by pair id, stored direction = smaller id -> larger id).

Source

pub fn two_view_geometries_since( &self, since: usize, ) -> (Vec<(PairId, Arc<TwoViewGeometry>)>, usize)

Pairs recorded after log position since and the new log position. For incremental correspondence graph updates.

Source

pub fn num_two_view_geometries(&self) -> usize

Number of stored two-view geometries.

Source

pub fn num_matched_pairs(&self) -> usize

Number of pairs with stored raw matches.

Source

pub fn retain_copy(&self, keep: impl Fn(&StoreImage) -> bool) -> FeatureStore

New store keeping only images for which keep is true. All cameras, image ids, pair data and geometry record order are kept as is. Large data (keypoints, descriptors, matches, geometry) are shared via Arc, so copying is cheap. For rewinding in incremental processing.

Source

pub fn save(&self, path: impl AsRef<Path>) -> Result<()>

Saves in the own binary format (little-endian).

Source

pub fn load(path: impl AsRef<Path>) -> Result<Self>

Reads the save format.

Trait Implementations§

Source§

impl Default for FeatureStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.