pub struct FeatureStore { /* private fields */ }Expand description
In-memory feature store.
Implementations§
Source§impl FeatureStore
impl FeatureStore
Sourcepub fn add_camera(&self, camera: Camera) -> Result<CameraId>
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).
Sourcepub fn update_camera(&self, camera: Camera) -> Result<()>
pub fn update_camera(&self, camera: Camera) -> Result<()>
Overwrites an existing camera (error if absent).
Sourcepub fn num_cameras(&self) -> usize
pub fn num_cameras(&self) -> usize
Number of cameras.
Sourcepub fn add_image(&self, name: &str, camera_id: CameraId) -> Result<ImageId>
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).
Sourcepub fn add_image_with_id(
&self,
image_id: ImageId,
name: &str,
camera_id: CameraId,
) -> Result<ImageId>
pub fn add_image_with_id( &self, image_id: ImageId, name: &str, camera_id: CameraId, ) -> Result<ImageId>
Adds an image with the given id.
Sourcepub fn image(&self, id: ImageId) -> Option<StoreImage>
pub fn image(&self, id: ImageId) -> Option<StoreImage>
Image lookup.
Sourcepub fn image_id_by_name(&self, name: &str) -> Option<ImageId>
pub fn image_id_by_name(&self, name: &str) -> Option<ImageId>
Name -> image id.
Sourcepub fn image_by_name(&self, name: &str) -> Option<StoreImage>
pub fn image_by_name(&self, name: &str) -> Option<StoreImage>
Looks up an image by name.
Sourcepub fn images(&self) -> Vec<StoreImage>
pub fn images(&self) -> Vec<StoreImage>
All images (ascending by id).
Sourcepub fn num_images(&self) -> usize
pub fn num_images(&self) -> usize
Number of images.
Sourcepub fn exists_image(&self, id: ImageId) -> bool
pub fn exists_image(&self, id: ImageId) -> bool
Whether the image exists.
Sourcepub fn set_pose_prior(&self, image_id: ImageId, prior: PosePrior)
pub fn set_pose_prior(&self, image_id: ImageId, prior: PosePrior)
Sets the image prior position.
Sourcepub fn pose_prior(&self, image_id: ImageId) -> Option<PosePrior>
pub fn pose_prior(&self, image_id: ImageId) -> Option<PosePrior>
Gets the image prior position.
Sourcepub fn set_keypoints(&self, image_id: ImageId, kps: Vec<Keypoint>)
pub fn set_keypoints(&self, image_id: ImageId, kps: Vec<Keypoint>)
Writes keypoints (overwrites).
Sourcepub fn set_descriptors(&self, image_id: ImageId, d: Descriptors)
pub fn set_descriptors(&self, image_id: ImageId, d: Descriptors)
Writes descriptors (overwrites).
Sourcepub fn keypoints(&self, image_id: ImageId) -> Option<Arc<Vec<Keypoint>>>
pub fn keypoints(&self, image_id: ImageId) -> Option<Arc<Vec<Keypoint>>>
Keypoint lookup (shared).
Sourcepub fn descriptors(&self, image_id: ImageId) -> Option<Arc<Descriptors>>
pub fn descriptors(&self, image_id: ImageId) -> Option<Arc<Descriptors>>
Descriptor lookup (shared).
Sourcepub fn exists_keypoints(&self, image_id: ImageId) -> bool
pub fn exists_keypoints(&self, image_id: ImageId) -> bool
Whether keypoints exist.
Sourcepub fn exists_descriptors(&self, image_id: ImageId) -> bool
pub fn exists_descriptors(&self, image_id: ImageId) -> bool
Whether descriptors exist.
Sourcepub fn num_keypoints(&self, image_id: ImageId) -> usize
pub fn num_keypoints(&self, image_id: ImageId) -> usize
Number of keypoints of the image (0 if absent).
Sourcepub fn largest_keypoint_count(&self) -> usize
pub fn largest_keypoint_count(&self) -> usize
Maximum of the per-image keypoint counts.
Sourcepub fn write_matches(
&self,
id1: ImageId,
id2: ImageId,
matches: &[FeatureMatch],
) -> Result<()>
pub fn write_matches( &self, id1: ImageId, id2: ImageId, matches: &[FeatureMatch], ) -> Result<()>
Writes raw matches (overwrites). Takes index pairs in (id1, id2) order.
Sourcepub fn read_matches(
&self,
id1: ImageId,
id2: ImageId,
) -> Option<Arc<Vec<FeatureMatch>>>
pub fn read_matches( &self, id1: ImageId, id2: ImageId, ) -> Option<Arc<Vec<FeatureMatch>>>
Raw match lookup in the (id1, id2) direction.
Sourcepub fn exists_matches(&self, id1: ImageId, id2: ImageId) -> bool
pub fn exists_matches(&self, id1: ImageId, id2: ImageId) -> bool
Whether raw matches exist.
Sourcepub fn delete_matches(&self, id1: ImageId, id2: ImageId)
pub fn delete_matches(&self, id1: ImageId, id2: ImageId)
Deletes raw matches.
Sourcepub fn put_two_view(
&self,
id1: ImageId,
id2: ImageId,
tvg: &TwoViewGeometry,
) -> Result<()>
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.
Sourcepub fn get_two_view(
&self,
id1: ImageId,
id2: ImageId,
) -> Option<Arc<TwoViewGeometry>>
pub fn get_two_view( &self, id1: ImageId, id2: ImageId, ) -> Option<Arc<TwoViewGeometry>>
Two-view geometry in the (id1 -> id2) direction.
Sourcepub fn contains_two_view(&self, id1: ImageId, id2: ImageId) -> bool
pub fn contains_two_view(&self, id1: ImageId, id2: ImageId) -> bool
Whether two-view geometry exists.
Sourcepub fn remove_two_view(&self, id1: ImageId, id2: ImageId)
pub fn remove_two_view(&self, id1: ImageId, id2: ImageId)
Deletes two-view geometry.
Sourcepub fn two_view_geometries(&self) -> Vec<(PairId, Arc<TwoViewGeometry>)>
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).
Sourcepub fn two_view_geometries_since(
&self,
since: usize,
) -> (Vec<(PairId, Arc<TwoViewGeometry>)>, usize)
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.
Sourcepub fn num_two_view_geometries(&self) -> usize
pub fn num_two_view_geometries(&self) -> usize
Number of stored two-view geometries.
Sourcepub fn num_matched_pairs(&self) -> usize
pub fn num_matched_pairs(&self) -> usize
Number of pairs with stored raw matches.
Sourcepub fn retain_copy(&self, keep: impl Fn(&StoreImage) -> bool) -> FeatureStore
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.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for FeatureStore
impl RefUnwindSafe for FeatureStore
impl Send for FeatureStore
impl Sync for FeatureStore
impl Unpin for FeatureStore
impl UnsafeUnpin for FeatureStore
impl UnwindSafe for FeatureStore
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.