UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
semantic.hpp
1
41#ifndef UFO_CORE_SEMANTIC_HPP
42#define UFO_CORE_SEMANTIC_HPP
43
44// UFO
45#include <ufo/core/confidence.hpp>
46#include <ufo/core/label.hpp>
47
48// STL
49#include <concepts>
50#include <format>
51#include <ostream>
52
53namespace ufo
54{
75struct Semantic {
80
85
93 [[nodiscard]] friend constexpr auto operator<=>(Semantic lhs,
94 Semantic rhs) noexcept = default;
95
103 [[nodiscard]] friend constexpr bool operator==(Semantic lhs,
104 Semantic rhs) noexcept = default;
105};
106
119inline std::ostream& operator<<(std::ostream& out, Semantic s)
120{
121 return out << s.label << ": " << s.confidence;
122}
123} // namespace ufo
124
125template <>
126struct std::formatter<ufo::Semantic> {
127 constexpr auto parse(std::format_parse_context& ctx) const { return ctx.begin(); }
128
129 auto format(ufo::Semantic s, std::format_context& ctx) const
130 {
131 return std::format_to(ctx.out(), "{}: {}", s.label, s.confidence);
132 }
133};
134#endif // UFO_CORE_SEMANTIC_HPP
All vision-related classes and functions.
Definition cloud.hpp:49
Represents a confidence score as a single float value.
Represents a semantic class label as a single unsigned integer value.
Definition label.hpp:72
Represents a semantic annotation as a pair of class label and confidence score.
Definition semantic.hpp:75
friend constexpr auto operator<=>(Semantic lhs, Semantic rhs) noexcept=default
Three-way comparison (lexicographic on label then value).
friend constexpr bool operator==(Semantic lhs, Semantic rhs) noexcept=default
Equality comparison.
Confidence confidence
The associated confidence or weight score.
Definition semantic.hpp:84
Label label
The discrete semantic class identifier.
Definition semantic.hpp:79