9#include <cvb/spectral/spectral.hpp>
10#include <cvb/spectral/cube.hpp>
11#include <cvb/spectral/arithmetic.hpp>
12#include <cvb/spectral/interpolator.hpp>
13#include <cvb/spectral/convert_color_space.hpp>
20 auto path = Cvb::ExpandPath(Cvb::InstallPath() + CVB_LIT(
"tutorial/Spectral/Images/Color/"));
21 Cvb::String objectHeader(path + CVB_LIT(
"ColorCube.hdr"));
22 Cvb::String objectBinary(path + CVB_LIT(
"ColorCube.bin"));
23 Cvb::String whiteRefHeader(path + CVB_LIT(
"WhiteCube.hdr"));
24 Cvb::String whiteRefBinary(path + CVB_LIT(
"WhiteCube.bin"));
25 Cvb::String blackRefHeader(path + CVB_LIT(
"DarkCube.hdr"));
26 Cvb::String blackRefBinary(path + CVB_LIT(
"DarkCube.bin"));
29 objectHeader <<
"\n\t" << objectBinary << std::endl;
31 whiteRefHeader <<
"\n\t" << whiteRefBinary << std::endl;
33 blackRefHeader <<
"\n\t" << blackRefBinary << std::endl;
41 std::cout <<
"Normalization done!" << std::endl;
49 std::cout <<
"Lab calculation done!" << std::endl;
51 std::cout <<
"sRGB calculation done!" << std::endl;
53 Cvb::String labFilename(Cvb::ExpandPath(CVB_LIT(
"%TMP%LabImage.tiff")));
54 Cvb::String rgbFilename(Cvb::ExpandPath(CVB_LIT(
"%TMP%sRGBImage.tiff")));
55 labImg->Save(labFilename);
56 rgbImg->Save(rgbFilename);
58 labFilename << std::endl;
59 std::cout <<
"Saved sRGB image to:\n\t" <<
60 rgbFilename << std::endl;
static std::unique_ptr< Cube > Load(Cvb::String EnviHeader, Cvb::String EnviBinary)
Static function Loads a cube from ENVI.
Definition: cube.hpp:315
static std::unique_ptr< Interpolator > Create(const Cube &cube, StdObserver stdObserver, StdIlluminant stdIlluminant, InterpolationMethod interpolationMethod)
Creates an Interpolator object.
Definition: interpolator.hpp:57
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
@ Linear
linear interpolation, at the border the last value is used
@ CIE2006_2deg
2006 Observer with 2 deg
std::unique_ptr< Cube > Normalization(const Cube &cubeIn, const Cube &whiteReference, const Cube &blackReference, NormalizationMethod normalizationMethod)
Normalizes a cube.
Definition: arithmetic.hpp:107
std::unique_ptr< Image > CubeToLab(const Cube &cube, const Interpolator &interpolator)
Converts a normalized cube to a Lab image.
Definition: convert_color_space.hpp:66