CVB++ 14.0
convert_color_space.hpp
1#pragma once
2
3#include <memory>
4
5#include "../global.hpp"
6#include "../_cexports/c_img.h"
7#include "interpolator.hpp"
8
9
10
11namespace Cvb
12{
13 CVB_BEGIN_INLINE_NS
14
15 namespace Spectral
16 {
17
19
27 std::unique_ptr<Image> CubeToXYZ(const Cube& cube, const Interpolator& interpolator)
28 {
29 return Internal::DoResCallObjectOut<Image>([&](void* & obj)
30 {
31 return CVB_CALL_CAPI(CVSConvertCubeToXYZ(cube.Handle()
32 , interpolator.Handle()
33 , obj));
34 });
35 }
36
37
39
48 void CubeToXYZ(const Cube& cube, const Interpolator& interpolator, Image& xyzImageOut)
49 {
50 auto obj = xyzImageOut.Handle();
51 CVB_CALL_CAPI_CHECKED(CVSConvertCubeToXYZ(cube.Handle()
52 , interpolator.Handle()
53 , obj));
54 }
55
56
58
66 std::unique_ptr<Image> CubeToLab(const Cube& cube, const Interpolator& interpolator)
67 {
68 return Internal::DoResCallObjectOut<Image>([&](void* & obj)
69 {
70 return CVB_CALL_CAPI(CVSConvertCubeToLab(cube.Handle()
71 , interpolator.Handle()
72 , obj));
73 });
74 }
75
76
78
85 void CubeToLab(const Cube& cube, const Interpolator& interpolator, Image& LabImageOut)
86 {
87 auto obj = LabImageOut.Handle();
88 CVB_CALL_CAPI_CHECKED(CVSConvertCubeToLab(cube.Handle()
89 , interpolator.Handle()
90 , obj));
91 }
92
93
95
101 std::unique_ptr<Image> XYZToLab(const Image& xyzImage, const Interpolator& interpolator)
102 {
103 return Internal::DoResCallObjectOut<Image>([&](void* & obj)
104 {
105 return CVB_CALL_CAPI(CVSConvertXYZToLab(xyzImage.Handle()
106 , interpolator.Handle()
107 , obj));
108 });
109 }
110
111
113
119 std::unique_ptr<Image> LabToRGB8(const Image& LabImage, const Interpolator& interpolator)
120 {
121 return Internal::DoResCallObjectOut<Image>([&](void* & obj)
122 {
123 return CVB_CALL_CAPI(CVSConvertLabToRGB8(LabImage.Handle()
124 , interpolator.Handle()
125 , obj));
126 });
127 }
128
129
130 }
131
132 CVB_END_INLINE_NS
133}
The Common Vision Blox image.
Definition: decl_image.hpp:45
void * Handle() const noexcept
Classic API image handle.
Definition: decl_image.hpp:223
Spectral Cube object.
Definition: cube.hpp:51
void * Handle() const noexcept
Returns C-API style handle to the Cube.
Definition: cube.hpp:366
Spectral Interpolator object.
Definition: interpolator.hpp:23
void * Handle() const noexcept
Returns C-API style handle to the Interpolator.
Definition: interpolator.hpp:123
std::unique_ptr< Image > CubeToXYZ(const Cube &cube, const Interpolator &interpolator)
Converts the cube to an XYZ image.
Definition: convert_color_space.hpp:27
std::unique_ptr< Image > LabToRGB8(const Image &LabImage, const Interpolator &interpolator)
Converts a Lab image to a sRGB 8bit image.
Definition: convert_color_space.hpp:119
std::unique_ptr< Image > XYZToLab(const Image &xyzImage, const Interpolator &interpolator)
Converts an image from XYZ to Lab.
Definition: convert_color_space.hpp:101
std::unique_ptr< Image > CubeToLab(const Cube &cube, const Interpolator &interpolator)
Converts the cube to a Lab image.
Definition: convert_color_space.hpp:66
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24