8 #ifndef META_OCEAN_CV_ADVANCED_BLACK_POINT_DETECTOR_H
9 #define META_OCEAN_CV_ADVANCED_BLACK_POINT_DETECTOR_H
38 typedef std::vector<float>
Color;
61 template <
unsigned int tChannels>
62 static Color detectBlackPointHistogram8BitPerChannel(
const uint8_t* frame,
const unsigned int width,
const unsigned int height,
const unsigned int framePaddingElements,
Worker* worker =
nullptr);
65 template <
unsigned int tChannels>
68 static_assert(tChannels != 0u,
"Invalid channel number!");
69 ocean_assert(frame && width != 0u && height != 0u);
71 Color blackPointColor(tChannels);
75 const unsigned int threshold = max(1u, (width * height + 1000u) / 2000u);
77 constexpr
float inv255 = 1.0f / 255.0f;
79 for (
unsigned int c = 0u; c < tChannels; c++)
81 const unsigned int* bins = histogram.
bins(c);
85 for (
unsigned int i = 0u; i < 256u; ++i)
87 if (bins[i] >= threshold)
89 blackPointColor[c] = float(i) * inv255;
95 return blackPointColor;
Provides functions for black point detection in a frame.
Definition: BlackPointDetector.h:32
static Color detectBlackPointHistogram(const Frame &frame, Worker *worker=nullptr)
Attempts to detect the black point in the given frame with three channels.
static Color detectBlackPointHistogram8BitPerChannel(const uint8_t *frame, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, Worker *worker=nullptr)
Attempts to detect the black point in the given frame with three channels.
Definition: BlackPointDetector.h:66
std::vector< float > Color
Definition of a vector holding 32 bit floating point values.
Definition: BlackPointDetector.h:38
This class implements a standard histogram object storing 8 bit per channel.
Definition: Histogram.h:208
const unsigned int * bins() const
Returns the 256 histogram values for a specific channel.
Definition: Histogram.h:1012
This class implements Ocean's image class.
Definition: Frame.h:1792
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