Class Medoid

Inheritance Relationships

Base Type

Class Documentation

class Medoid : public slam_mer::utils::DescriptorModel

The Medoid descriptor model computes the medoid of the added descriptors and returns it as the current descriptor. The medoid is the descriptor that has the smallest average distance to the other descriptors.

Public Types

typedef std::shared_ptr<Medoid> shared_ptr

Typedef for shared pointer of type Medoid.

Public Functions

Medoid() = default

Medoid descriptor model constructor.

~Medoid() override = default

Medoid descriptor model destructor.

inline virtual output_t<descriptor_t> predict(const pose_t &pose_ = pose_t(), const point3d_t &point_ = point3d_t()) override

Predicts the descriptor for a given pose and point.

Parameters:
  • pose_ – The pose for which to predict the descriptor (not used in this model).

  • point_ – The point for which to predict the descriptor (not used in this model).

Returns:

The medoid descriptor of the added descriptors.

virtual void fit(const descriptor_t &descriptor_, const pose_t &pose_ = pose_t(), const point3d_t &point_ = point3d_t()) override

Adds a new descriptor to the model and updates the current descriptor to be the medoid of the added descriptors.

Parameters:
  • descriptor_ – The new descriptor to add to the model.

  • pose_ – The pose of the keyframe that observed the descriptor (not used in this model).

  • point_ – The 3d point observation associated with the new descriptor (not used in this model).

Public Static Functions

static inline shared_ptr make_shared()

Creates a shared Medoid instance.

Returns:

Shared pointer to a new Medoid object.

Private Members

vector_t<descriptor_t> _descriptorHistory

History of added descriptors.

std::vector<std::vector<float>> _unitDescriptorHistory

Cached unit-normalized descriptors for incremental medoid updates.

std::vector<float> _squaredDistanceSums

Running sum of squared distances per descriptor.