Class descriptor_t
Defined in File descriptor.hpp
Class Documentation
-
class descriptor_t
Represents a feature descriptor as a float vector.
The descriptor values can be normalized and converted to packed formats for matching or model input.
Public Types
-
using vector = std::vector<descriptor_t>
Typedef for a vector of descriptors.
Public Functions
-
inline descriptor_t()
Default constructor.
-
inline descriptor_t(const std::vector<float> &data_)
Construct a new Pointdescriptor_t object.
- Parameters:
data_ – Descriptor values copied into internal storage.
-
inline descriptor_t(const descriptor_t &other_)
Copy constructor.
- Parameters:
other_ – Descriptor instance copied into this object.
-
inline descriptor_t(float *data_, const size_t size_)
Construct a new descriptor_t object from a pointer to data.
- Parameters:
data_ – Pointer to the first float value of the descriptor buffer.
size_ – Number of float values read from
data_. and its size.
-
inline bool is_empty() const
Check if this descriptor is empty (all elements are zero).
- Returns:
truewhen no descriptor values are stored.
-
inline const std::vector<float> &get_data() const
Get the description object.
- Returns:
with the descriptor data.
-
inline size_t get_size() const
Get the size of the descriptor (number of elements).
- Returns:
Number of float elements in this descriptor.
-
inline void normalize_l2()
Normalize the descriptor using L2 norm.
-
inline void normalize_l1()
Normalize the descriptor using L1 norm.
-
inline void sqrt()
Apply square root to each element of the descriptor.
-
inline void print() const
Print the descriptor values to the console.
Public Static Functions
-
static inline std::vector<float> flatten_descriptors(const descriptor_t::vector &descriptors_)
Flattens descriptors into a contiguous float buffer.
- Parameters:
descriptors_ – Descriptor list appended sequentially into one buffer.
- Returns:
Flat vector containing all descriptor values in order.
-
static inline std::vector<std::vector<float>> to_float_vector(const descriptor_t::vector &descriptors_)
Convert a vector of descriptors to a std::vector<std::vector<float>>.
- Parameters:
descriptors_ – Descriptor list converted into nested float vectors.
- Returns:
list of descriptors
-
static inline bool is_empty(const descriptor_t &descriptor_)
Check if a descriptor is empty (all elements are zero).
- Parameters:
descriptor_ – Descriptor instance tested for stored values.
- Returns:
true if all elements are zero, false otherwise.
Private Members
-
std::vector<float> _data
descriptor_t data, using a set of floats
-
using vector = std::vector<descriptor_t>