IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
peak_icv_color_space.hpp
Go to the documentation of this file.
1
10#pragma once
11
12#include <peak_common_c/detail/peak_common_defines.h>
14#include <peak_icv_c/algorithms/preprocessing/peak_icv_color_matrix_transformation.h>
15
16#include <ostream>
17#include <string>
18
19namespace peak
20{
21namespace pipeline
22{
29enum class ColorSpace
30{
31 SRGB_D50 = PEAK_ICV_COLOR_SPACE_SRGB_D50,
32 SRGB_D65 = PEAK_ICV_COLOR_SPACE_SRGB_D65,
33 CIE_RGB_E = PEAK_ICV_COLOR_SPACE_CIE_RGB_E,
34 ECI_RGB_D50 = PEAK_ICV_COLOR_SPACE_ECI_RGB_D50,
35 Adobe_RGB_D65 = PEAK_ICV_COLOR_SPACE_ADOBE_RGB_D65
36};
37
41PEAK_COMMON_NO_DISCARD inline std::string ToString(ColorSpace colorSpace)
42{
43 switch (colorSpace)
44 {
46 return "SRGB_D50";
48 return "SRGB_D65";
50 return "CIE_RGB_E";
52 return "ECI_RGB_D50";
54 return "Adobe_RGB_D65";
55 default:
56 const auto csStr = std::to_string(static_cast<int>(colorSpace));
57 throw peak::icv::NotSupportedException("The given color space " + csStr + " is unknown!");
58 }
59}
60
61inline std::ostream& operator<<(std::ostream& os, ColorSpace colorSpace)
62{
63 return os << ToString(colorSpace);
64}
65
66namespace detail
67{
68PEAK_COMMON_NO_DISCARD inline ColorSpace ToColorSpace(const std::string& colorSpace)
69{
70 if (colorSpace == "SRGB_D50")
71 {
73 }
74 if (colorSpace == "SRGB_D65")
75 {
77 }
78 if (colorSpace == "CIE_RGB_E")
79 {
81 }
82 if (colorSpace == "ECI_RGB_D50")
83 {
85 }
86 if (colorSpace == "Adobe_RGB_D65")
87 {
89 }
90
91 throw peak::icv::NotSupportedException("The given color space " + colorSpace + " is unknown!");
92}
93} // namespace detail
94} // namespace pipeline
95} // namespace peak
Occurs when a requested operation is not implemented or supported (e.g., exporting to an unsupported ...
ColorSpace
Color spaces supported by the chromatic adaptation feature.
ColorSpace ToColorSpace(const std::string &colorSpace)
std::string ToString(BinningMode mode)
Converts a BinningMode enum value to its string representation.
std::ostream & operator<<(std::ostream &os, BinningMode mode)
Stream output operator for BinningMode enum.