27 #include <VisionX/interface/core/DataTypes.h>
28 #include <VisionX/interface/components/Calibration.h>
39 struct ImageFormatInfo;
40 class ImageProviderInfo;
71 void convertImage(
const ImageFormatInfo& imageFormat,
const ImageType destinationImageType,
void* inputData,
void* outputData);
87 void convertImage(
const ImageProviderInfo& imageProviderInfo,
void* inputData,
void* outputData);
98 CByteImage*
createByteImage(
const ImageFormatInfo& imageFormat,
const ImageType imageType);
111 CByteImage*
createByteImage(
const ImageProviderInfo& imageProviderInfo);
122 CFloatImage*
createFloatImage(
const ImageFormatInfo& imageFormat,
const ImageType imageType);
142 inline float rgbToDepthValue(
unsigned char r,
unsigned char g,
unsigned char b,
bool noiseResistant =
false)
147 constexpr
char size = 8;
148 constexpr
int channels = 3;
151 auto add = [&](
unsigned char v,
char channelNumber)
153 auto end = size * channels;
154 for (
int offset = 0; offset < end; offset += channels)
156 auto tmp = (
v & 0b1) << (channelNumber + offset);
171 result = (r + (g << 8) + (b << 16));
176 inline void depthValueToRGB(
unsigned int depthInMM,
unsigned char& r,
unsigned char& g,
unsigned char& b,
bool noiseResistant =
false)
181 constexpr
char size = 8;
182 constexpr
int channels = 3;
183 auto toRGB = [&](
unsigned int v,
char channelNumber)
186 v =
v >> channelNumber;
188 for (
int offset = 0; offset < size; offset++)
190 int shift =
std::max(offset * channels - offset, 0);
191 int masked =
v & mask;
192 int shiftedV = masked >> shift;
194 mask = mask << channels;
199 r = toRGB(depthInMM, 0);
200 g = toRGB(depthInMM, 1);
201 b = toRGB(depthInMM, 2);
205 r = depthInMM & 0xFF;
206 g = (depthInMM >> 8) & 0xFF;
207 b = (depthInMM >> 16) & 0xFF;
217 inline ostream&
operator<<(ostream& os,
const visionx::ImageDimension& dimension)
219 os << dimension.width <<
"x" << dimension.height;