Ocean
Ocean::CV::FrameInterpolatorTrilinear Class Reference

This class implements tri-linear frame interpolator functions. More...

Static Public Member Functions

static bool resize (const FramePyramid &source, uint8_t *target, const unsigned int targetWidth, const unsigned int targetHeight, const unsigned int targetPaddingElements, Worker *worker=nullptr)
 Resizes the finest layer of a given frame pyramid by a tri-linear interpolation and optionally uses a worker object to distribute the computational load. More...
 
static bool resize (const FramePyramid &source, Frame &target, Worker *worker=nullptr)
 Resizes the finest layer of a given frame pyramid by a tri-linear interpolation and optionally uses a worker object to distribute the computational load. More...
 
static bool resize (const Frame &source, Frame &target, Worker *worker=nullptr)
 Resizes a given frame by a tri-linear interpolation and optionally uses a worker object to distribute the computational load. More...
 
static bool resize (Frame &frame, const unsigned int newWidth, const unsigned int newHeight, Worker *worker=nullptr)
 Resizes a given frame by a tri-linear interpolation and optionally uses a worker object to distribute the computational load. More...
 
template<unsigned int tChannels>
static void homography8BitPerChannel (const FramePyramid &sourcePyramid, const unsigned int width, const unsigned int height, const SquareMatrix3 &homography, const uint8_t *borderColor, uint8_t *target, Worker *worker=nullptr)
 Transforms a given 8 bit per channel input frame into an output frame by application of a homography. More...
 
static Vector3 interpolatePosition (const unsigned int layerCount, const Vector2 &centerPosition, const Vector2 &cornerPosition1, const Vector2 &cornerPosition2, const Vector2 &cornerPosition3, const Vector2 &cornerPosition4)
 Calculates a 3D position usable for tri-linear interpolation. More...
 
template<unsigned int tChannels>
static void interpolateFullBorder8BitPerChannel (const FramePyramid &framePyramid, const Vector3 &position, uint8_t *result)
 Performs a pixel lookup in the frame pyramid using tri-linear interpolation. More...
 
template<unsigned int tChannels, bool tAlphaAtFront, bool tTransparentIs0xFF>
static void interpolateInfiniteBorder8BitPerChannelAlpha (const FramePyramid &framePyramid, const Vector3 &position, uint8_t *result)
 Performs a pixel lookup in the frame pyramid using tri-linear interpolation with infinite transparent frame border. More...
 
template<unsigned int tChannels>
static void resize8BitPerChannel (const FramePyramid &source, uint8_t *target, const unsigned int targetWidth, const unsigned int targetHeight, const unsigned int targetPaddingElements, Worker *worker=nullptr)
 Renders the passed source frame pyramid into the target frame using tri-linear interpolation. More...
 

Static Protected Member Functions

template<unsigned int tChannels, void tBilinearInterpolationFunction, void tLinearInterpolationFunction>
static void interpolate8BitPerChannel (const FramePyramid &framePyramid, const Vector3 &position, uint8_t *result)
 Performs a pixel lookup in the frame pyramid using tri-linear interpolation. More...
 
template<unsigned int tChannels>
static void interpolateTwoPixels8BitPerChannel (const uint8_t *first, const unsigned int firstFactor, const uint8_t *second, uint8_t *result)
 This function determines the linear interpolation result for to given layer pixels. More...
 
template<unsigned int tChannels, bool tAlphaAtFront, bool tTransparentIs0xFF>
static void interpolateTwoPixels8BitPerChannelAlpha (const uint8_t *first, const unsigned int firstFactor, const uint8_t *second, uint8_t *result)
 This function determines the linear interpolation result for to given layer pixels while the interpolation result respects the alpha values of both pixels. More...
 
template<unsigned int tChannels>
static void resize8BitPerChannelSubset (const FramePyramid *source, uint8_t *target, const unsigned int targetWidth, const unsigned int targetHeight, const unsigned int targetPaddingElements, const unsigned int firstTargetRow, const unsigned int numberTargetRows)
 Renders the passed source frame pyramid into the target frame using tri-linear interpolation. More...
 
template<unsigned int tChannels>
static void homography8BitPerChannelSubset (const FramePyramid *sourcePyramid, const unsigned int width, const unsigned int height, const SquareMatrix3 *homography, const uint8_t *borderColor, uint8_t *target, const unsigned int firstRow, const unsigned int numberRows)
 Transforms an 8 bit per channel frame using the given homography. More...
 

Detailed Description

This class implements tri-linear frame interpolator functions.

Member Function Documentation

◆ homography8BitPerChannel()

template<unsigned int tChannels>
void Ocean::CV::FrameInterpolatorTrilinear::homography8BitPerChannel ( const FramePyramid sourcePyramid,
const unsigned int  width,
const unsigned int  height,
const SquareMatrix3 homography,
const uint8_t *  borderColor,
uint8_t *  target,
Worker worker = nullptr 
)
inlinestatic

Transforms a given 8 bit per channel input frame into an output frame by application of a homography.

Parameters
sourcePyramidFrame pyramid of input frame that will be transformed
widthThe width of both input images in pixel
heightThe height of both input images pixel
homographyHomography used to transform the given input frame
borderColorColor of undefined pixel positions, the size of the buffer must match to the number of channels, nullptr to assign 0x00 to each channel
targetOutput frame using the given homography
workerOptional worker object to distribute the computational load
Template Parameters
tChannelsNumber of channels of the frame
See also
homographyWithCamera8BitPerChannel().

◆ homography8BitPerChannelSubset()

template<unsigned int tChannels>
void Ocean::CV::FrameInterpolatorTrilinear::homography8BitPerChannelSubset ( const FramePyramid sourcePyramid,
const unsigned int  width,
const unsigned int  height,
const SquareMatrix3 homography,
const uint8_t *  borderColor,
uint8_t *  target,
const unsigned int  firstRow,
const unsigned int  numberRows 
)
staticprotected

Transforms an 8 bit per channel frame using the given homography.

Parameters
sourcePyramidFrame pyramid of input frame that will be transformed
widthThe width of both input images in pixel
heightThe height of both input images pixel
homographyHomography used to transform the given input frame
borderColorColor of undefined pixel positions, the size of the buffer must match to the number of channels, nullptr to assign 0x00 to each channel
targetOutput frame resulting by application of the given homography
firstRowThe first row to be handled
numberRowsNumber of rows to be handled
Template Parameters
tChannelsNumber of frame channels

◆ interpolate8BitPerChannel()

template<unsigned int tChannels, void tBilinearInterpolationFunction, void tLinearInterpolationFunction>
void Ocean::CV::FrameInterpolatorTrilinear::interpolate8BitPerChannel ( const FramePyramid framePyramid,
const Vector3 position,
uint8_t *  result 
)
inlinestaticprotected

Performs a pixel lookup in the frame pyramid using tri-linear interpolation.


The position is given as 3D-vector, where x & y specify the 2d image coordinates in pixel units of the finest frame pyramid layer
and z specifies the pyramid layer index. Values with fractions for x,y & z are used as interpolation weights between neighboring pixels and layers.

Parameters
framePyramidFrame pyramid to determine the pixel values from
positionImage coordinates (x, y) and layer (z), for which pixel values are interpolated using tri-linear interpolation within the range [0, framePyramid.finestLayerWidth()]x[0, framePyramid.finestLayerWidth()]x[0, layerCount - 1u]
resultPointer to resulting interpolated pixel values (1Byte per color channel)
Template Parameters
tChannelsDefines the number of channels the frame holds
tBilinearInterpolationFunctionThe bilinear interpolation function that will be used to interpolate the pixel values within one frame pyramid layer
tLinearInterpolationFunctionThe linear interpolation function that will be used to interpolate the pixel values between two frame pyramid layers
See also
FrameInterpolatorBilinear::interpolatePixel8BitPerChannel(), FrameInterpolatorBilinear::interpolateFullAlphaBorder8BitPerChannel().

◆ interpolateFullBorder8BitPerChannel()

template<unsigned int tChannels>
void Ocean::CV::FrameInterpolatorTrilinear::interpolateFullBorder8BitPerChannel ( const FramePyramid framePyramid,
const Vector3 position,
uint8_t *  result 
)
inlinestatic

Performs a pixel lookup in the frame pyramid using tri-linear interpolation.


The position is given as 3D-vector, where x & y specify the 2d image coordinates in pixel units of the finest frame pyramid layer
and z specifies the pyramid layer index. Values with fractions for x,y & z are used as interpolation weights between neighboring pixels and layers.

Parameters
framePyramidFrame pyramid to determine the pixel values from
positionImage coordinates (x, y) and layer (z), for which pixel values are interpolated using tri-linear interpolation within the range [0, framePyramid.finestLayerWidth()]x[0, framePyramid.finestLayerWidth()]x[0, layerCount - 1u]
resultPointer to resulting interpolated pixel values (1Byte per color channel)
Template Parameters
tChannelsDefines the number of channels the frame holds

◆ interpolateInfiniteBorder8BitPerChannelAlpha()

template<unsigned int tChannels, bool tAlphaAtFront, bool tTransparentIs0xFF>
void Ocean::CV::FrameInterpolatorTrilinear::interpolateInfiniteBorder8BitPerChannelAlpha ( const FramePyramid framePyramid,
const Vector3 position,
uint8_t *  result 
)
inlinestatic

Performs a pixel lookup in the frame pyramid using tri-linear interpolation with infinite transparent frame border.


The position is given as 3D-vector, where x & y specify the 2d image coordinates in pixel units of the finest frame pyramid layer
and z specifies the pyramid layer index. Values with fractions for x,y & z are used as interpolation weights between neighboring pixels and layers.

Parameters
framePyramidFrame pyramid to determine the pixel values from
positionImage coordinates (x, y) and layer (z), for which pixel values are interpolated using tri-linear interpolation within the range [0, framePyramid.finestLayerWidth()]x[0, framePyramid.finestLayerWidth()]x[0, layerCount - 1u]
resultPointer to resulting interpolated pixel values (1Byte per color channel)
Template Parameters
tChannelsDefines the number of channels the frame holds
tAlphaAtFrontTrue, if the alpha channel is in the front of the data channels
tTransparentIs0xFFTrue, if 0xFF is interpreted as fully transparent

◆ interpolatePosition()

Vector3 Ocean::CV::FrameInterpolatorTrilinear::interpolatePosition ( const unsigned int  layerCount,
const Vector2 centerPosition,
const Vector2 cornerPosition1,
const Vector2 cornerPosition2,
const Vector2 cornerPosition3,
const Vector2 cornerPosition4 
)
inlinestatic

Calculates a 3D position usable for tri-linear interpolation.

The specified image coordinates define the center and four corner positions of quad. The center position determines the x- and y-coordinate of the resulting 3D sampling position. The corner positions determine the z-coordinate of the resulting sampling position and the pyramid layers from which samples are retrieved. The vertices have to be specified in clockwise order.

Parameters
layerCountNumber of layers supported by the pyramid
centerPositionQuad center coordinates in pixels of the finest pyramid layer, used for the actual texture look-up
cornerPosition1First quad corner coordinates in pixels of the finest pyramid layer, used for interpolation between pyramid layers
cornerPosition2Second quad corner coordinates in pixels of the finest pyramid layer, used for interpolation between pyramid layers
cornerPosition3Third quad corner coordinates in pixels of the finest pyramid layer, used for interpolation between pyramid layers
cornerPosition4Fourth quad corner coordinates in pixels of the finest pyramid layer, used for interpolation between pyramid layers
Returns
The image coordinates (x, y) and layer (z) within the range [0, framePyramid.finestLayerWidth()]x[0, framePyramid.finestLayerWidth()]x[0, layerCount - 1u]

◆ interpolateTwoPixels8BitPerChannel()

template<unsigned int tChannels>
void Ocean::CV::FrameInterpolatorTrilinear::interpolateTwoPixels8BitPerChannel ( const uint8_t *  first,
const unsigned int  firstFactor,
const uint8_t *  second,
uint8_t *  result 
)
inlinestaticprotected

This function determines the linear interpolation result for to given layer pixels.

Parameters
firstThe first pixel data
firstFactorFirst interpolation factor, with range [0, 128]
secondThe second pixel data
resultInterpolation result
Template Parameters
tChannelsDefines the number of channels the frame holds

◆ interpolateTwoPixels8BitPerChannelAlpha()

template<unsigned int tChannels, bool tAlphaAtFront, bool tTransparentIs0xFF>
void Ocean::CV::FrameInterpolatorTrilinear::interpolateTwoPixels8BitPerChannelAlpha ( const uint8_t *  first,
const unsigned int  firstFactor,
const uint8_t *  second,
uint8_t *  result 
)
inlinestaticprotected

This function determines the linear interpolation result for to given layer pixels while the interpolation result respects the alpha values of both pixels.

Parameters
firstThe first pixel data
firstFactorFirst interpolation factor, with range [0, 128]
secondThe second pixel data
resultInterpolation result
Template Parameters
tChannelsDefines the number of channels the frame holds
tAlphaAtFrontTrue, if the alpha channel is in the front of the data channels
tTransparentIs0xFFTrue, if 0xFF is interpreted as fully transparent

◆ resize() [1/4]

static bool Ocean::CV::FrameInterpolatorTrilinear::resize ( const Frame source,
Frame target,
Worker worker = nullptr 
)
static

Resizes a given frame by a tri-linear interpolation and optionally uses a worker object to distribute the computational load.

This method creates a new frame pyramid of the source frame, which creates additional computational load.

Parameters
sourceThe source frame buffer to resize
targetThe target frame buffer
workerOptional worker object used for load distribution
Returns
True, if the frame could be resized

◆ resize() [2/4]

static bool Ocean::CV::FrameInterpolatorTrilinear::resize ( const FramePyramid source,
Frame target,
Worker worker = nullptr 
)
static

Resizes the finest layer of a given frame pyramid by a tri-linear interpolation and optionally uses a worker object to distribute the computational load.

Parameters
sourceFrame pyramid whose finest layer is resized
targetThe target frame buffer
workerOptional worker object used for load distribution
Returns
True, if the frame could be resized

◆ resize() [3/4]

static bool Ocean::CV::FrameInterpolatorTrilinear::resize ( const FramePyramid source,
uint8_t *  target,
const unsigned int  targetWidth,
const unsigned int  targetHeight,
const unsigned int  targetPaddingElements,
Worker worker = nullptr 
)
static

Resizes the finest layer of a given frame pyramid by a tri-linear interpolation and optionally uses a worker object to distribute the computational load.

Beware: This method assumes that the pixel format of the target is identical to the pixel format of the frame pyramid.

Parameters
sourceFrame pyramid provided the frame which will be resized
targetThe target frame buffer
targetWidthWidth of the target frame in pixel, with range [1, infinity)
targetHeightHeight of the target frame in pixel, with range [1, infinity)
targetPaddingElementsThe number of padding elements at the end of each target row, in elements, with range [0, infinity)
workerOptional worker object used for load distribution
Returns
True, if the frame could be resized

◆ resize() [4/4]

static bool Ocean::CV::FrameInterpolatorTrilinear::resize ( Frame frame,
const unsigned int  newWidth,
const unsigned int  newHeight,
Worker worker = nullptr 
)
static

Resizes a given frame by a tri-linear interpolation and optionally uses a worker object to distribute the computational load.

This method creates a new frame pyramid of the source frame, which creates additional computational load.

Parameters
frameThe frame to be resized in place
newWidthNew width of the frame in pixel, with range [1, infinity)
newHeightNew height of the frame in pixel, with range [1, infinity)
workerOptional worker object used for load distribution
Returns
True, if the frame could be resized

◆ resize8BitPerChannel()

template<unsigned int tChannels>
void Ocean::CV::FrameInterpolatorTrilinear::resize8BitPerChannel ( const FramePyramid source,
uint8_t *  target,
const unsigned int  targetWidth,
const unsigned int  targetHeight,
const unsigned int  targetPaddingElements,
Worker worker = nullptr 
)
inlinestatic

Renders the passed source frame pyramid into the target frame using tri-linear interpolation.

Parameters
sourceThe source frame pyramid that is read from. The pyramid needs to have the appropriate layers
targetThe target frame buffer
targetWidthWidth of the target frame in pixel
targetHeightHeight of the target frame in pixel
targetPaddingElementsThe number of padding elements at the end of each target row, in elements, with range [0, infinity)
workerOptional worker object used for load distribution
Template Parameters
tChannelsDefines the number of channels the frame holds

◆ resize8BitPerChannelSubset()

template<unsigned int tChannels>
void Ocean::CV::FrameInterpolatorTrilinear::resize8BitPerChannelSubset ( const FramePyramid source,
uint8_t *  target,
const unsigned int  targetWidth,
const unsigned int  targetHeight,
const unsigned int  targetPaddingElements,
const unsigned int  firstTargetRow,
const unsigned int  numberTargetRows 
)
staticprotected

Renders the passed source frame pyramid into the target frame using tri-linear interpolation.

Parameters
sourceThe source frame pyramid that is read from. The pyramid needs to have the appropriate layers
targetThe target frame buffer
targetWidthWidth of the target frame in pixel
targetHeightHeight of the target frame in pixel
targetPaddingElementsThe number of padding elements at the end of each target row, in elements, with range [0, infinity)
firstTargetRowFirst (including) row to convert
numberTargetRowsNumber of rows to convert
Template Parameters
tChannelsDefines the number of channels the frame holds

The documentation for this class was generated from the following file: