Class WeightedAverage

Inheritance Relationships

Base Type

Class Documentation

class WeightedAverage : public slam_mer::utils::DescriptorModel

The Weighted Average descriptor model computes the weighted average of the added descriptors and returns it as the current descriptor. The weight is based on the angle between the view direction of the observation and the view direction of the added descriptors.

Public Types

typedef std::shared_ptr<WeightedAverage> shared_ptr

Typedef for shared pointer of type WeightedAverage.

Public Functions

WeightedAverage() = default

Weighted Average descriptor model constructor.

~WeightedAverage() override = default

Weighted Average 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.

  • point_ – The point for which to predict the descriptor.

Returns:

The weighted average descriptor of the added descriptors.

inline 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.

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

  • pose_ – The pose of the keyframe that observed the descriptor.

  • point_ – The 3d point observation associated with the new descriptor.

Public Static Functions

static inline shared_ptr make_shared()

Creates a shared WeightedAverage instance.

Returns:

Shared pointer to a new WeightedAverage object.

Private Functions

void __compute_weighted_average(const point3d_t &point_, const pose_t &pose_)

Computes the weighted average of the added descriptors.

Parameters:
  • point_ – The 3d point for which to compute the weighted average.

  • pose_ – The pose for which to compute the weighted average.

Private Members

vector_t<descriptor_t> _descriptorHistory

History of added descriptors.

vector_t<Eigen::Vector3d> _viewVectorHistory

History of view vectors corresponding to the added descriptors.

double _alpha = 10.0

The alpha parameter for the weighted average computation.