This class implements functions to determine the frame variance.
More...
|
template<typename T , typename TIntegral > |
static bool | deviation1Channel8Bit (const T *frame, const TIntegral *integral, uint8_t *deviation, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, const unsigned int deviationPaddingElements, const unsigned int window) |
| This functions determines the frame deviation of a 1 channel 8 bit frame. More...
|
|
template<typename T > |
static bool | deviation1Channel8Bit (const T *frame, uint8_t *deviation, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, const unsigned int deviationPaddingElements, const unsigned int window) |
| This functions determines the deviation within a 1-channel 8 bit frame. More...
|
|
template<typename TElementType , typename TSummationType , typename TMultiplicationType , unsigned int tChannels> |
static void | imageStatistics (const TElementType *frame, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, double *mean=nullptr, double *variance=nullptr, double *standardDeviation=nullptr) |
| Compute the per-channel mean, variance, and standard deviation over an image. More...
|
|
This class implements functions to determine the frame variance.
◆ deviation1Channel8Bit() [1/2]
template<typename T , typename TIntegral >
static bool Ocean::CV::FrameVariance::deviation1Channel8Bit |
( |
const T * |
frame, |
|
|
const TIntegral * |
integral, |
|
|
uint8_t * |
deviation, |
|
|
const unsigned int |
width, |
|
|
const unsigned int |
height, |
|
|
const unsigned int |
framePaddingElements, |
|
|
const unsigned int |
deviationPaddingElements, |
|
|
const unsigned int |
window |
|
) |
| |
|
static |
This functions determines the frame deviation of a 1 channel 8 bit frame.
- Parameters
-
frame | Original frame to determine the variance for |
integral | Bordered integral frame of the original frame with border size equal have of the specified window size, the border must be mirrored |
deviation | Resulting deviation frame |
width | The width of the original frame |
height | The height of the original frame |
framePaddingElements | The number of padding elements at the end of each frame row, in elements, with range [0, infinity) |
deviationPaddingElements | The number of padding elements at the end of each deviation row, in elements, with range [0, infinity) |
window | Size of the window must be odd, with range [1, infinity) |
- Returns
- True, if succeeded
◆ deviation1Channel8Bit() [2/2]
template<typename T >
static bool Ocean::CV::FrameVariance::deviation1Channel8Bit |
( |
const T * |
frame, |
|
|
uint8_t * |
deviation, |
|
|
const unsigned int |
width, |
|
|
const unsigned int |
height, |
|
|
const unsigned int |
framePaddingElements, |
|
|
const unsigned int |
deviationPaddingElements, |
|
|
const unsigned int |
window |
|
) |
| |
|
static |
This functions determines the deviation within a 1-channel 8 bit frame.
The function uses an integral image for the calculation of the deviation.
- Parameters
-
frame | The frame for which the deviation will be determined, must be valid |
deviation | Resulting deviation frame |
width | The width of the given frame, in pixel, with range [1, infinity) |
height | The height of the given frame, in pixel, with range [1, infinity) |
framePaddingElements | The number of padding elements at the end of each frame row, in elements, with range [0, infinity) |
deviationPaddingElements | The number of padding elements at the end of each deviation row, in elements, with range [0, infinity) |
window | Size of the window must be odd, with range [1, min(width, height) * 2] |
- Returns
- True, if succeeded
- Template Parameters
-
T | The data type of the frame elements, either 'int8_t' or 'uint8_t' |
◆ imageStatistics()
template<typename TElementType , typename TSummationType , typename TMultiplicationType , unsigned int tChannels>
void Ocean::CV::FrameVariance::imageStatistics |
( |
const TElementType * |
frame, |
|
|
const unsigned int |
width, |
|
|
const unsigned int |
height, |
|
|
const unsigned int |
framePaddingElements, |
|
|
double * |
mean = nullptr , |
|
|
double * |
variance = nullptr , |
|
|
double * |
standardDeviation = nullptr |
|
) |
| |
|
static |
Compute the per-channel mean, variance, and standard deviation over an image.
The basic outline of the computation is this (this example assumes no multi-channel and no stride but the actual implementation supports both, of course):
T0 imagePixels[pixelCount] = { ... };
T1 sum = 0;
T1 squareSum = 0;
for (i = 0; i < pixelCount; ++i)
{
sum[i] += T1(imagePixels[i]);
squareSum[i] += T1(T2(imagePixel[i]) * T2(imagePixels[i]))
}
double mean = (double)sum / (double)pixelCount
double variance = ((double)squareSum / pixelCount) - (mean * mean);
double stddev = std::sqrt(variance)
- Note
- The most related OpenCV function is cv::meanStdDev()
- Parameters
-
frame | The input frame; mustn't be empty and must be a 1-channel image |
width | The width of the input image, range: [1, infinity) |
height | The height of the input image, range: [1, infinity) |
framePaddingElements | Optional number of padding elements at the end of each source row, in elements, with range [0, infinity) |
mean | Array for the resulting per-channel mean values, will be ignored if set to nullptr otherwise it must have channels elements |
variance | Array for the resulting per-channel variance, will be ignored if set to nullptr otherwise it must have channels elements |
standardDeviation | Array for the resulting per-channel standard deviations, will be ignored if set to nullptr otherwise it must have channels elements |
- Template Parameters
-
TElementType | Type of the elements of the pixels of the input image |
TSummationType | Type used for the internal computation of the pixel sums (should be at least as large as TElementType ), cf. function description for details |
TMultiplicationType | Type used to compute the square values of pixels (allows control over integer vs. floating point multiplication), cf. function description for details |
tChannels | Number of channels of the input image, range: [1, infinity) |
The documentation for this class was generated from the following file: