Ocean
|
Implementation of Contrast-Limited Adaptive Histogram Equalization (CLAHE). More...
Public Types | |
typedef std::array< unsigned int, histogramSize > | TileHistogram |
Tile histogram. More... | |
typedef LookupCenter2< uint8_t > | TileLookupCenter2 |
Image partitioning and tile boundary lookup. More... | |
Static Public Member Functions | |
static void | equalization8BitPerChannel (const uint8_t *const source, const unsigned int width, const unsigned height, uint8_t *const target, const Scalar clipLimit=Scalar(40), const unsigned int horizontalTiles=8u, const unsigned int verticalTiles=8u, const unsigned int sourcePaddingElements=0u, const unsigned int targetPaddingElements=0u, Worker *worker=nullptr) |
Histogram equalization a la CLAHE. More... | |
Static Public Attributes | |
static constexpr unsigned int | histogramSize = 256u |
Number of bins in the tile histograms. More... | |
Static Protected Member Functions | |
static void | computeLookupTable (const uint8_t *source, const unsigned int width, const unsigned int height, uint8_t *const lookupTable, const Scalar clipLimit, const unsigned int sourcePaddingElements=0u) |
Computation of a lookup table required to normalize an image histogram (used per tile) More... | |
static void | computeTileLookupTables (const uint8_t *const source, const TileLookupCenter2 &lookupCenter2, std::vector< uint8_t > &tileLookupTables, const Scalar clipLimit, const unsigned int sourcePaddingElements=0u, Worker *worker=nullptr) |
Computation of per-tile lookup tables required to normalize an image histogram given a partitioned image. More... | |
static void | computeLowBilinearInterpolationFactors7BitPrecision (const TileLookupCenter2 &lookupCenter2, const bool isHorizontal, Index32 *lowBins, uint8_t *lowFactors_fixed7) |
Computation of the bilinear interpolation parameters for the low bins of an image pixel If isHorizontal == true , this function computes the horizontal interpolation parameters, i.e., the left bins and left interpolation factors, otherwise it will compute the top bins and interpolation factors. More... | |
static void | bilinearInterpolation (const uint8_t *const source, const TileLookupCenter2 &lookupCenter2, uint8_t *const target, const std::vector< uint8_t > &tileLookupTables, const unsigned int sourcePaddingElements=0u, const unsigned int targetPaddingElements=0u, Worker *worker=nullptr) |
Histogram normalization by bilinearly interpolating pixels using the CLAHE per-tile lookup tables. More... | |
static void | computeTileLookupTablesSubset (const uint8_t *const source, const TileLookupCenter2 *lookupCenter2, uint8_t *const tileLookupTables, const Scalar clipLimit, const unsigned int sourcePaddingElements=0u, const unsigned int firstTile=0u, const unsigned int tileCount=0u) |
Helper function for the computation of per-tile lookup tables required to normalize an image histogram given a partitioned image. More... | |
static void | bilinearInterpolation7BitPrecisionSubset (const uint8_t *const source, const TileLookupCenter2 *lookupCenter2, uint8_t *const target, const uint8_t *const tileLookupTables, const Index32 *const leftBins, const uint8_t *const leftFactors_fixed7, const unsigned int sourcePaddingElements=0u, const unsigned int targetPaddingElements=0u, const unsigned int rowStart=0u, const unsigned int rowCount=0u) |
Integer-based (fixed-point arithmetic) helper function for the histogram normalization by bilinearly interpolating pixels using the CLAHE per-tile lookup tables. More... | |
static void | bilinearInterpolationNEON7BitPrecisionSubset (const uint8_t *const source, const TileLookupCenter2 *lookupCenter2, uint8_t *const target, const uint8_t *const tileLookupTables, const Index32 *const leftBins, const uint8_t *const leftFactors_fixed7, const Index32 *const topBins, const uint8_t *const topFactors_fixed7, const unsigned int sourcePaddingElements=0u, const unsigned int targetPaddingElements=0u, const unsigned int tileStart=0u, const unsigned int tileCount=0u) |
Helper function for the histogram normalization by bilinearly interpolating pixels using the CLAHE per-tile lookup tables. More... | |
Implementation of Contrast-Limited Adaptive Histogram Equalization (CLAHE).
typedef std::array<unsigned int, histogramSize> Ocean::CV::ContrastLimitedAdaptiveHistogram::TileHistogram |
Tile histogram.
Image partitioning and tile boundary lookup.
|
staticprotected |
Histogram normalization by bilinearly interpolating pixels using the CLAHE per-tile lookup tables.
source | Pointer to the data of the source frame that will be processed, must be valid and 8-bit unsigned, 1-channel (FrameType::FORMAT_Y8 ) |
lookupCenter2 | Defines how the source frame is partitioned, image size and number of bins will be extracted from this object, must be valid |
target | Pointer to the data of the target frame, must be valid and 8-bit unsigned, 1-channel (FrameType::FORMAT_Y8 ) |
tileLookupTables | Storage location for the computed lookup tables; will be initialized internally to size N x 256, where N = the total number of bins |
sourcePaddingElements | Number of padding elements in the source data, range: [0, infinity), default: 0 |
targetPaddingElements | Number of padding elements in the target data, range: [0, infinity), default: 0 |
worker | Optional worker instance for parallel execution, default: nullptr |
|
staticprotected |
Integer-based (fixed-point arithmetic) helper function for the histogram normalization by bilinearly interpolating pixels using the CLAHE per-tile lookup tables.
source | Pointer to the data of the source frame that will be processed, must be valid and 8-bit unsigned, 1-channel (FrameType::FORMAT_Y8 ) |
lookupCenter2 | Defines how the source frame is partitioned, image size and number of bins will be extracted from this object, must be valid |
target | Pointer to the data of the target frame, must be valid and 8-bit unsigned, 1-channel (FrameType::FORMAT_Y8 ) |
tileLookupTables | Storage location for the computed lookup tables; will be initialized internally to size N x 256, where N = the total number of bins |
leftBins | Stores the indices of the closest bins left of a horizontal pixel location, must be initialized, expected size: image width |
leftFactors_fixed7 | Stores the horizontal interpolation factors for the left bins (as fixed-point number with 7-bit precision), must be initialized, expected size: image width |
sourcePaddingElements | Number of padding elements in the source data, range: [0, infinity), default: 0 |
targetPaddingElements | Number of padding elements in the target data, range: [0, infinity), default: 0 |
rowStart | First image row to process, range: [0, height) |
rowCount | Number of rows to process, range: [0, height - rowStart) |
|
staticprotected |
Helper function for the histogram normalization by bilinearly interpolating pixels using the CLAHE per-tile lookup tables.
source | Pointer to the data of the source frame that will be processed, must be valid and 8-bit unsigned, 1-channel (FrameType::FORMAT_Y8 ) |
lookupCenter2 | Defines how the source frame is partitioned, image size and number of bins will be extracted from this object, must be valid |
target | Pointer to the data of the target frame, must be valid and 8-bit unsigned, 1-channel (FrameType::FORMAT_Y8 ) |
tileLookupTables | Storage location for the computed lookup tables; will be initialized internally to size N x 256, where N = the total number of bins |
leftBins | Stores the indices of the closest bins left of a horizontal pixel location, must be initialized, expected size: image width |
leftFactors_fixed7 | Stores the horizontal interpolation factors for the left bins (as fixed-point number with 7-bit precision), must be initialized, expected size: image width |
topBins | Stores the indices of the closest vertical bins above a pixel location, must be initialized, expected size: image height |
topFactors_fixed7 | Stores the vertical interpolation factors for the top bins (as fixed-point number with 7-bit precision), must be initialized, expected size: image height |
sourcePaddingElements | Number of padding elements in the source data, range: [0, infinity), default: 0 |
targetPaddingElements | Number of padding elements in the target data, range: [0, infinity), default: 0 |
tileStart | First tile to process, range: [0, N), where N = number of tiles |
tileCount | Number of tiles to process, range: [0, N - tileStart) |
|
inlinestaticprotected |
Computation of a lookup table required to normalize an image histogram (used per tile)
source | Pointer to the data of the source frame that will be processed, must be valid and 8-bit unsigned, 1-channel (FrameType::FORMAT_Y8 ) |
width | The width of the source and target frames, range: [1, infinity) |
height | The height of the source and target frames, range: [1, infinity) |
lookupTable | Storage location for the computed lookup table, must be initialized, expected size: 256 |
clipLimit | Scaling factor to determine the tile clip limit, tileClipLimit = clipLimit * N , where N = (tileSize / histogramSize) is the number of pixels per bin if all pixels are distributed evenly over the histogram (average), range: [0, infinity) |
sourcePaddingElements | Number of padding elements in the source data, range: [0, infinity), default: 0 |
|
staticprotected |
Computation of the bilinear interpolation parameters for the low bins of an image pixel If isHorizontal == true
, this function computes the horizontal interpolation parameters, i.e., the left bins and left interpolation factors, otherwise it will compute the top bins and interpolation factors.
For the horizontal parameters (isHorizontal == true
), the right counterparts can be computed as:
rightBins[i] = lowBins[i] + 1u
rightFactors_fixed7[i] = 128u - lowFactors_fixed7[i]
and, similarly, for the vertical parameters (isHorizontal == false
).
Note: 128u is the fixed-point, 7-bit precision equivalent of 1.0f
lookupCenter2 | Defines how the source frame is partitioned, image size and number of bins will be extracted from this object, must be valid, number of bins (binsX() ) must >= 2 |
isHorizontal | If true, it will compute the horizontal interpolation parameters, otherwise the vertical parameters will be computed |
lowBins | Stores the indices of the closest lower (lower = left if isHorizontal == true , otherwise lower = top) bins of a pixel location, must be initialized before calling this function, expected size: image width if isHorizontal == true , otherwise image height |
lowFactors_fixed7 | Stores the horizontal (if isHorizontal == true ) or vertical (if isHorizontal == false ) interpolation factors for the lower bins (as 8-bit fixed point numbers with 7-bit precision, i.e. range: [0, 1]), must be initialized before calling this function, expected size: image width if isHorizontal == true , otherwise image height |
|
staticprotected |
Computation of per-tile lookup tables required to normalize an image histogram given a partitioned image.
source | Pointer to the data of the source frame that will be processed, must be valid and 8-bit unsigned, 1-channel (FrameType::FORMAT_Y8 ) |
lookupCenter2 | Defines how the source frame is partitioned, image size and number of bins will be extracted from this object, must be valid |
tileLookupTables | Storage location for the computed lookup tables; will be initialized internally to size N x 256, where N = the total number of bins |
clipLimit | Scaling factor to determine the tile clip limit, tileClipLimit = clipLimit * N , where N = (tileSize / histogramSize) is the number of pixels per bin if all pixels are distributed evenly over the histogram (average), range: [0, infinity) |
sourcePaddingElements | Number of padding elements in the source data, range: [0, infinity), default: 0 |
worker | Optional worker instance for parallel execution, default: nullptr |
|
staticprotected |
Helper function for the computation of per-tile lookup tables required to normalize an image histogram given a partitioned image.
source | Pointer to the data of the source frame that will be processed, must be valid and 8-bit unsigned, 1-channel (FrameType::FORMAT_Y8 ) |
lookupCenter2 | Defines how the source frame is partitioned, image size and number of bins will be extracted from this object, must be valid |
tileLookupTables | Storage location for the computed lookup tables; will be initialized internally to size N x 256, where N = the total number of bins |
clipLimit | Scaling factor to determine the tile clip limit, tileClipLimit = clipLimit * N , where N = (tileSize / histogramSize) is the number of pixels per bin if all pixels are distributed evenly over the histogram (average), range: [0, infinity) |
sourcePaddingElements | Number of padding elements in the source data, range: [0, infinity), default: 0 |
firstTile | Index of first tile to process, range: [0, N), where N is the total number of tiles |
tileCount | Number of tiles to process, range: [1, N], such firstTile + tileCount < N where N is the total number of tiles |
|
static |
Histogram equalization a la CLAHE.
source | Pointer to the data of the source frame that will be processed, must be valid and 8-bit unsigned, 1-channel (FrameType::FORMAT_Y8 ) |
width | The width of the source and target frames, range: [horizontalTiles, infinity) |
height | The height of the source and target frames, range: [verticalTiles, infinity) |
target | Destination location for the result, must be valid and 8-bit unsigned, 1-channel (FrameType::FORMAT_Y8 ) and have the same size as the source |
clipLimit | Global scaling factor to determine the tile clip limit, tileClipLimit = clipLimit * N , where N = (tileSize / histogramSize) is the number of pixels per bin if all pixels are distributed evenly over the histogram (average), range: [0, infinity), default: 40 |
horizontalTiles | Number of tiles the source image will be split horizontally, range: [2, width], default: 8 |
verticalTiles | Number of tiles the source image will be split vertically, range: [2, height], default: 8 |
sourcePaddingElements | Number of padding elements in the source data, range: [0, infinity), default: 0 |
targetPaddingElements | Number of padding elements in the target data, range: [0, infinity), default: 0 |
worker | Optional worker instance for parallel execution, default: nullptr |
|
staticconstexpr |
Number of bins in the tile histograms.