8#ifndef META_OCEAN_CV_FRAME_CONVERTER_COLOR_MAP_H
9#define META_OCEAN_CV_FRAME_CONVERTER_COLOR_MAP_H
121 inline LookupData(
const float minValue,
const float maxValue,
const uint8_t*
const lookupTable);
127 inline float minValue()
const;
133 inline float maxValue()
const;
139 inline const uint8_t* lookupTable()
const;
169 static inline void convertJetFloat1ChannelToRGB24(
const float*
const source, uint8_t*
const target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const float minSource = 0.0f,
const float maxSource = 1.0f,
Worker* worker =
nullptr);
185 static void convertTurboFloat1ChannelToRGB24(
const float*
const source, uint8_t*
const target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const float minSource = 0.0f,
const float maxSource = 1.0f,
Worker* worker =
nullptr);
201 static void convertInfernoFloat1ChannelToRGB24(
const float*
const source, uint8_t*
const target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const float minSource = 0.0f,
const float maxSource = 1.0f,
Worker* worker =
nullptr);
218 static inline void convertSpiralFloat1ChannelToRGB24(
const float*
const source, uint8_t*
const target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const float minSource = 0.0f,
const float maxSource = 1.0f,
const float period = 0.1f,
Worker* worker =
nullptr);
272 lookupTable_(lookupTable)
294 ocean_assert(source !=
nullptr && target !=
nullptr);
295 ocean_assert(width >= 1u && height >= 1u);
296 ocean_assert(minSource < maxSource);
298 const unsigned int sourceStrideElements = width + sourcePaddingElements;
299 const unsigned int targetStrideElements = width * 3u + targetPaddingElements;
301 const float options[2] =
307 const bool areContinuous = sourcePaddingElements == 0u && targetPaddingElements == 0u;
309 FrameConverter::convertGenericPixelFormat<float, uint8_t>(source, target, width, height, sourceStrideElements, targetStrideElements, flag,
CV::FrameConverterColorMap::convertRowJetFloat1ChannelToRGB24, CV::FrameChannels::reverseRowPixelOrderInPlace<uint8_t, 3u>, areContinuous, options, worker);
312inline void FrameConverterColorMap::convertSpiralFloat1ChannelToRGB24(
const float*
const source, uint8_t*
const target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const float minSource,
const float maxSource,
const float period,
Worker* worker)
314 ocean_assert(source !=
nullptr && target !=
nullptr);
315 ocean_assert(width >= 1u && height >= 1u);
316 ocean_assert(minSource < maxSource);
317 ocean_assert(period > 0.0f);
319 const unsigned int sourceStrideElements = width + sourcePaddingElements;
320 const unsigned int targetStrideElements = width * 3u + targetPaddingElements;
322 const float options[3] =
329 const bool areContinuous = sourcePaddingElements == 0u && targetPaddingElements == 0u;
331 FrameConverter::convertGenericPixelFormat<float, uint8_t>(source, target, width, height, sourceStrideElements, targetStrideElements, flag,
CV::FrameConverterColorMap::convertRowSpiralFloat1ChannelToRGB24, CV::FrameChannels::reverseRowPixelOrderInPlace<uint8_t, 3u>, areContinuous, options, worker);
The following comfort class provides comfortable functions simplifying prototyping applications but a...
Definition FrameConverterColorMap.h:64
static bool convert1ChannelToRGB24(const Frame &source, Frame &target, const ColorMap colorMap, Worker *worker=nullptr)
Converts a 1-channel frame to a RGB24 frame using a specified color map.
static bool convertFloat1ChannelToRGB24(const Frame &source, Frame &target, const ColorMap colorMap, Worker *worker=nullptr, float minValue=NumericF::maxValue(), float maxValue=NumericF::minValue())
Converts a 1-channel float frame to a RGB24 frame using a specified color map.
static bool convertInteger1ChannelToRGB24(const Frame &source, Frame &target, const ColorMap colorMap, Worker *worker=nullptr)
Converts a 1-channel integer frame to a RGB24 frame using a specified color map.
Helper class for converters with lookup table.
Definition FrameConverterColorMap.h:112
LookupData(const float minValue, const float maxValue, const uint8_t *const lookupTable)
Creates a new lookup object.
Definition FrameConverterColorMap.h:269
float minValue() const
Return the minimal source value.
Definition FrameConverterColorMap.h:277
const float minValue_
The minimal source value, with range (-infinity, infinity).
Definition FrameConverterColorMap.h:144
const uint8_t *const lookupTable_
The actual lookup table.
Definition FrameConverterColorMap.h:150
const float maxValue_
The minimal source value, with range (minValue, infinity).
Definition FrameConverterColorMap.h:147
const uint8_t * lookupTable() const
Returns the actual lookup table.
Definition FrameConverterColorMap.h:287
float maxValue() const
Return the maximal source value.
Definition FrameConverterColorMap.h:282
This class provides functions to convert frames based on a color map.
Definition FrameConverterColorMap.h:29
ColorMap
Definition of individual color maps.
Definition FrameConverterColorMap.h:36
@ CM_JET
The Jet color map, as implemented in convertJetFloat1ChannelToRGB24().
Definition FrameConverterColorMap.h:40
@ CM_TURBO
The Turbo color map, as implemented in convertTurboFloat1ChannelToRGB24().
Definition FrameConverterColorMap.h:42
@ CM_SPIRAL_10
The Spiral color map with 10 spiral rounds, as implemented in convertSpiralFloat1ChannelToRGB24().
Definition FrameConverterColorMap.h:46
@ CM_INFERNO
The Inferno color map, as implemented in convertInfernoFloat1ChannelToRGB24().
Definition FrameConverterColorMap.h:44
@ CM_SPIRAL_20
The Spiral color map with 20 spiral rounds, as implemented in convertSpiralFloat1ChannelToRGB24().
Definition FrameConverterColorMap.h:48
static void convertTurboFloat1ChannelToRGB24(const float *const source, uint8_t *const target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const float minSource=0.0f, const float maxSource=1.0f, Worker *worker=nullptr)
Converts a row of a 1-channel float frame to a row of a RGB24 frame using the Turbo color map.
static ColorMap translateColorMap(const std::string &colorMap)
Translates the name of a color map to it's value.
static void convertRowJetFloat1ChannelToRGB24(const float *source, uint8_t *target, const size_t width, const void *options)
Converts a row of a 1-channel float frame to a row of a RGB24 frame using the Jet color map.
static void convertSpiralFloat1ChannelToRGB24(const float *const source, uint8_t *const target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const float minSource=0.0f, const float maxSource=1.0f, const float period=0.1f, Worker *worker=nullptr)
Converts a row of a 1-channel float frame to a row of a RGB24 frame using the Spiral color map.
Definition FrameConverterColorMap.h:312
static void convertJetFloat1ChannelToRGB24(const float *const source, uint8_t *const target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const float minSource=0.0f, const float maxSource=1.0f, Worker *worker=nullptr)
Converts a row of a 1-channel float frame to a row of a RGB24 frame using the Jet color map.
Definition FrameConverterColorMap.h:292
static void convertRowLookupFloat1ChannelToRGB24(const float *source, uint8_t *target, const size_t width, const void *options)
Converts a row of a 1-channel float frame to a row of a RGB24 frame using a lookup table.
static void convertRowSpiralFloat1ChannelToRGB24(const float *source, uint8_t *target, const size_t width, const void *options)
Converts a row of a 1-channel float frame to a row of a RGB24 frame using the Spiral color map.
static const ColorMaps & definedColorMaps()
Returns all defined color maps.
static std::string translateColorMap(const ColorMap colorMap)
Translates the values of a color map to a readable string.
std::vector< ColorMap > ColorMaps
Definition of a vector holding color map values.
Definition FrameConverterColorMap.h:56
static void convertInfernoFloat1ChannelToRGB24(const float *const source, uint8_t *const target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const float minSource=0.0f, const float maxSource=1.0f, Worker *worker=nullptr)
Converts a row of a 1-channel float frame to a row of a RGB24 frame using the Inferno color map.
This is the base class for all frame converter classes.
Definition FrameConverter.h:32
ConversionFlag
Definition of individual conversion flags.
Definition FrameConverter.h:39
This class implements Ocean's image class.
Definition Frame.h:1808
This class implements a worker able to distribute function calls over different threads.
Definition Worker.h:33
The namespace covering the entire Ocean framework.
Definition Accessor.h:15