UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
concepts.hpp
1
45#ifndef UFO_VISION_COLOR_CONCEPTS_HPP
46#define UFO_VISION_COLOR_CONCEPTS_HPP
47
48// UFO
49#include <ufo/vision/color/flags.hpp>
50#include <ufo/vision/color/type_traits.hpp>
51
52// STL
53#include <concepts>
54#include <cstdint>
55
56namespace ufo
57{
63/**************************************************************************************
64| |
65| Core Color Concept |
66| |
67**************************************************************************************/
68
72template <typename T>
73concept Color = is_color_v<T>;
74
75/**************************************************************************************
76| |
77| Value Type Concepts |
78| |
79**************************************************************************************/
80
84template <typename T>
85concept FloatingPointColor = Color<T> && std::floating_point<value_type_t<T>>;
86
90template <typename T>
91concept IntegralColor = Color<T> && std::integral<value_type_t<T>>;
92
93/**************************************************************************************
94| |
95| Flag-Based Concepts |
96| |
97**************************************************************************************/
98
102template <typename T>
103concept ColorWithAlpha = Color<T> && has_alpha_v<T>;
104
108template <typename T>
109concept ColorWithWeight = Color<T> && has_weight_v<T>;
110
114template <typename T>
116
120template <typename T>
121concept BasicColor = Color<T> && (color_traits<T>::flags == ColorFlags::None);
122
123/**************************************************************************************
124| |
125| Color Model Concepts |
126| |
127**************************************************************************************/
128
132template <typename T>
133concept GrayColor = Color<T> && (color_traits<T>::model == ColorModel::Gray);
134
138template <typename T>
139concept RgbColor = Color<T> && (color_traits<T>::model == ColorModel::Rgb);
140
144template <typename T>
145concept LinearRgbColor = Color<T> && (color_traits<T>::model == ColorModel::Lrgb);
146
150template <typename T>
151concept LabColor = Color<T> && (color_traits<T>::model == ColorModel::Lab);
152
156template <typename T>
157concept LchColor = Color<T> && (color_traits<T>::model == ColorModel::Lch);
158
159/**************************************************************************************
160| |
161| Grouped Color Model Concepts |
162| |
163**************************************************************************************/
164
168template <typename T>
170
174template <typename T>
176
180template <typename T>
182
186template <typename T>
188
192template <typename T>
194
195/**************************************************************************************
196| |
197| Specialized Use Case Concepts |
198| |
199**************************************************************************************/
200
204template <typename T>
206
211template <typename T>
212concept ImageColor =
214
219template <typename T>
221
225template <typename T>
227
231template <typename T>
232concept CompactColor = IntegralColor<T> && (sizeof(value_type_t<T>) <= 2);
233
234/**************************************************************************************
235| |
236| Multi-Type Concepts |
237| |
238**************************************************************************************/
239
243template <typename T1, typename T2>
245 Color<T1> && Color<T2> && std::same_as<value_type_t<T1>, value_type_t<T2>>;
246
250template <typename T1, typename T2>
252 Color<T1> && Color<T2> && (color_traits<T1>::model == color_traits<T2>::model);
253
257template <typename T1, typename T2>
259 Color<T1> && Color<T2> && (color_traits<T1>::flags == color_traits<T2>::flags);
260
264template <typename T1, typename T2>
267
271template <typename From, typename To>
273 Color<From> && Color<To> && std::convertible_to<value_type_t<From>, value_type_t<To>>;
274
278template <typename T1, typename T2>
281
282/**************************************************************************************
283| |
284| Value Type Extraction Concepts |
285| |
286**************************************************************************************/
287
291template <typename T, typename ValueType>
292concept ColorWithValueType = Color<T> && std::same_as<value_type_t<T>, ValueType>;
293
297template <typename T>
299
303template <typename T>
305
309template <typename T>
311
315template <typename T>
317
318/**************************************************************************************
319| |
320| Predicate Concepts for Algorithms |
321| |
322**************************************************************************************/
323
327template <typename T>
329
333template <typename From, typename To>
336
340template <typename T>
342
346template <typename T>
348
352} // namespace ufo
353
354#endif // UFO_VISION_COLOR_CONCEPTS_HPP
Colors that support weighted accumulation (floating-point with weight).
Definition concepts.hpp:205
Colors without optional channels (no alpha, no weight).
Definition concepts.hpp:121
Colors that can be blended together (same model and mutually convertible types).
Definition concepts.hpp:279
Colors with a 16-bit channel type.
Definition concepts.hpp:304
Colors with an 8-bit channel type.
Definition concepts.hpp:298
Colors with a 64-bit double channel type.
Definition concepts.hpp:316
Colors with a 32-bit float channel type.
Definition concepts.hpp:310
Colors that support color space conversion between display color models.
Definition concepts.hpp:334
Colors with both alpha and weight channels.
Definition concepts.hpp:115
Colors that include an alpha channel.
Definition concepts.hpp:103
Colors with a specific channel type.
Definition concepts.hpp:292
Colors that include a weight channel.
Definition concepts.hpp:109
Identifies any UFO color instantiation (Gray, Lab, Lch, Lrgb, Rgb).
Definition concepts.hpp:73
Colors optimized for compact storage (integral, at most 16 bits per channel).
Definition concepts.hpp:232
Colors with compatible channel types for conversion.
Definition concepts.hpp:272
Color models suitable for display (Rgb, Lrgb, or Gray).
Definition concepts.hpp:181
Two colors that are equivalent (same model, channel type, and flags).
Definition concepts.hpp:265
Colors with a floating-point channel type.
Definition concepts.hpp:85
Colors that support gamma correction (Rgb family).
Definition concepts.hpp:328
Grayscale colors (Gray<T, Flags>).
Definition concepts.hpp:133
Colors suitable for high dynamic range operations (floating-point display colors).
Definition concepts.hpp:220
Color models with a hue component (Lch).
Definition concepts.hpp:187
Colors suitable for image processing (integral, or floating-point display colors).
Definition concepts.hpp:212
Colors with an integral channel type.
Definition concepts.hpp:91
Convenience alias: any UFO color instantiation.
Definition concepts.hpp:347
Oklab perceptual colors (Lab<T, Flags>).
Definition concepts.hpp:151
OkLch cylindrical colors (Lch<T, Flags>).
Definition concepts.hpp:157
Color models with a lightness component (Lab or Lch).
Definition concepts.hpp:193
Linear-light Rgb colors (Lrgb<T, Flags>).
Definition concepts.hpp:145
Perceptual color models (Lab or Lch).
Definition concepts.hpp:175
Colors that operate in a perceptually uniform space.
Definition concepts.hpp:341
Gamma-encoded sRgb colors (Rgb<T, Flags>).
Definition concepts.hpp:139
Rgb-family colors (gamma-encoded or linear: Rgb or Lrgb).
Definition concepts.hpp:169
Two colors with the same flags.
Definition concepts.hpp:258
Two colors with the same color model.
Definition concepts.hpp:251
Two colors with the same underlying channel type.
Definition concepts.hpp:244
Colors with transparency support.
Definition concepts.hpp:226
@ None
No optional fields.
All vision-related classes and functions.
Definition cloud.hpp:49