Ocean
Ocean::CV::FrameEnlarger Class Reference

This class implements functions to enlarge/up-sample frames. More...

Data Structures

class  Comfort
 The following comfort class provides comfortable functions simplifying prototyping applications but also increasing binary size of the resulting applications. More...
 

Static Public Member Functions

template<unsigned int tChannelsWithAlpha, bool tAlphaAtFront, bool tSourceHasAlpha, bool tTransparentIs0xFF>
static void addTransparentBorder8BitPerChannel (const unsigned char *source, unsigned char *target, const unsigned int width, const unsigned int height, const unsigned int leftBorder, const unsigned int topBorder, const unsigned int rightBorder, const unsigned int bottomBorder, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
 Adds a transparent border to a given frame. More...
 
template<typename T , unsigned int tChannels>
static void addBorder (const T *source, T *target, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int borderSizeLeft, const unsigned int borderSizeTop, const unsigned int borderSizeRight, const unsigned int borderSizeBottom, const T *color, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
 Adds a border to a given frame while all new pixels will receive a specified border color/value. More...
 
template<typename T , unsigned int tChannels>
static void addBorderNearestPixel (const T *source, T *target, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int borderSizeLeft, const unsigned int borderSizeTop, const unsigned int borderSizeRight, const unsigned int borderSizeBottom, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
 Adds a border to a given frame while the color of the border pixels are defined by the nearest pixels of the original frame. More...
 
template<typename T , unsigned int tChannels>
static void addBorderMirrored (const T *source, T *target, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int borderSizeLeft, const unsigned int borderSizeTop, const unsigned int borderSizeRight, const unsigned int borderSizeBottom, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
 Adds a border to a given frame by mirroring the frame's content. More...
 
template<typename T , unsigned int tChannels>
static void multiplyByTwo (const T *source, T *target, const unsigned int targetWidth, const unsigned int targetHeight, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
 Doubles the size of a given frame by a pixel repeating upsampling. More...
 

Static Private Member Functions

template<typename T , unsigned int tChannels>
static void multiplyByTwoSubset (const T *source, T *target, const unsigned int targetWidth, const unsigned int targetHeight, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const unsigned int firstTargetRow, const unsigned int numberTargetRows)
 Doubles a subset of a given frame by a pixel repeating upsampling. More...
 

Detailed Description

This class implements functions to enlarge/up-sample frames.

Member Function Documentation

◆ addBorder()

template<typename T , unsigned int tChannels>
void Ocean::CV::FrameEnlarger::addBorder ( const T *  source,
T *  target,
const unsigned int  sourceWidth,
const unsigned int  sourceHeight,
const unsigned int  borderSizeLeft,
const unsigned int  borderSizeTop,
const unsigned int  borderSizeRight,
const unsigned int  borderSizeBottom,
const T *  color,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements 
)
static

Adds a border to a given frame while all new pixels will receive a specified border color/value.

Parameters
sourceThe source image to be extended, must be valid
targetThe target image receiving the extended frame, with resolution (sourceWidth + borderSizeLeft + borderSizeRight)x(sourceHeight + borderSizeTop + borderSizeBottom), must be valid
sourceWidthWidth of the original source image in pixel, with range [1, infinity)
sourceHeightHeight of the original source image in pixel, with range [1, infinity)
borderSizeLeftThe size of the border at the left image boundary, in pixel, with range [0, infinity)
borderSizeTopThe size of the border at the top image boundary, in pixel, with range [0, infinity)
borderSizeRightThe size of the border at the right image boundary, in pixel, with range [0, infinity)
borderSizeBottomThe size of the border at the bottom image boundary, in pixel, with range [0, infinity)
colorBorder color/value to be used for the new border pixels, must be tChannels values
sourcePaddingElementsThe number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsThe number of padding elements at the end of each target row, in elements, with range [0, infinity)
Template Parameters
TThe data type of a pixel channel
tChannelsThe number of data channels, with range [1, infinity)

◆ addBorderMirrored()

template<typename T , unsigned int tChannels>
void Ocean::CV::FrameEnlarger::addBorderMirrored ( const T *  source,
T *  target,
const unsigned int  sourceWidth,
const unsigned int  sourceHeight,
const unsigned int  borderSizeLeft,
const unsigned int  borderSizeTop,
const unsigned int  borderSizeRight,
const unsigned int  borderSizeBottom,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements 
)
static

Adds a border to a given frame by mirroring the frame's content.

Parameters
sourceThe source image to be extended, must be valid
targetThe target image receiving the extended frame, with resolution (sourceWidth + borderSizeLeft + borderSizeRight)x(sourceHeight + borderSizeTop + borderSizeBottom), must be valid
sourceWidthWidth of the original source image in pixel, with range [1, infinity)
sourceHeightHeight of the original source image in pixel, with range [1, infinity)
borderSizeLeftThe size of the border at the left image boundary, in pixel, with range [0, sourceWidth]
borderSizeTopThe size of the border at the top image boundary, in pixel, with range [0, sourceHeight]
borderSizeRightThe size of the border at the right image boundary, in pixel, with range [0, sourceWidth]
borderSizeBottomThe size of the border at the bottom image boundary, in pixel, with range [0, sourceHeight]
sourcePaddingElementsThe number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsThe number of padding elements at the end of each target row, in elements, with range [0, infinity)
Template Parameters
TThe data type of a pixel channel
tChannelsThe number of data channels, with range [1, infinity)

◆ addBorderNearestPixel()

template<typename T , unsigned int tChannels>
void Ocean::CV::FrameEnlarger::addBorderNearestPixel ( const T *  source,
T *  target,
const unsigned int  sourceWidth,
const unsigned int  sourceHeight,
const unsigned int  borderSizeLeft,
const unsigned int  borderSizeTop,
const unsigned int  borderSizeRight,
const unsigned int  borderSizeBottom,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements 
)
static

Adds a border to a given frame while the color of the border pixels are defined by the nearest pixels of the original frame.

Parameters
sourceThe source image to be extended, must be valid
targetThe target image receiving the extended frame, with resolution (sourceWidth + borderSizeLeft + borderSizeRight)x(sourceHeight + borderSizeTop + borderSizeBottom), must be valid
sourceWidthWidth of the original source image in pixel, with range [1, infinity)
sourceHeightHeight of the original source image in pixel, with range [1, infinity)
borderSizeLeftThe size of the border at the left image boundary, in pixel, with range [0, infinity)
borderSizeTopThe size of the border at the top image boundary, in pixel, with range [0, infinity)
borderSizeRightThe size of the border at the right image boundary, in pixel, with range [0, infinity)
borderSizeBottomThe size of the border at the bottom image boundary, in pixel, with range [0, infinity)
sourcePaddingElementsThe number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsThe number of padding elements at the end of each target row, in elements, with range [0, infinity)
Template Parameters
TThe data type of a pixel channel
tChannelsThe number of data channels, with range [1, infinity)

◆ addTransparentBorder8BitPerChannel()

template<unsigned int tChannelsWithAlpha, bool tAlphaAtFront, bool tSourceHasAlpha, bool tTransparentIs0xFF>
void Ocean::CV::FrameEnlarger::addTransparentBorder8BitPerChannel ( const unsigned char *  source,
unsigned char *  target,
const unsigned int  width,
const unsigned int  height,
const unsigned int  leftBorder,
const unsigned int  topBorder,
const unsigned int  rightBorder,
const unsigned int  bottomBorder,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements 
)
static

Adds a transparent border to a given frame.

The color of the transparent border pixels are taken from the nearest image pixel.

Parameters
sourceThe source frame which will be extended with a transparent border
targetResulting target frame with transparent border
widthThe width of the source frame in pixel, with range [1, infinity)
heightThe height of the source frame in pixel, with range [1, infinity)
leftBorderSize of the left frame border in pixel, with range [1, infinity)
topBorderSize of the top frame border in pixel, with range [1, infinity)
rightBorderSize of the right frame border in pixel, with range [1, infinity)
bottomBorderSize of the bottom frame border in pixel, with range [1, infinity)
sourcePaddingElementsThe number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsThe number of padding elements at the end of each target row, in elements, with range [0, infinity)
Template Parameters
tChannelsWithAlphaNumber of channels in the source frame (including the alpha channel)
tAlphaAtFrontTrue, if the alpha channel is in the front of the data channels
tSourceHasAlphaTrue, if not only the source frame holds an alpha channel but also the target frame, however values in a target alpha channel will be untouched
tTransparentIs0xFFTrue, if 0xFF is interpreted as fully transparent

◆ multiplyByTwo()

template<typename T , unsigned int tChannels>
void Ocean::CV::FrameEnlarger::multiplyByTwo ( const T *  source,
T *  target,
const unsigned int  targetWidth,
const unsigned int  targetHeight,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
Worker worker = nullptr 
)
static

Doubles the size of a given frame by a pixel repeating upsampling.

Parameters
sourceBuffer of the source frame to be upsampled
targetBuffer of the target frame receiving the upsampled frame
targetWidthWidth of the target buffer in pixel, with range [2, infinity) and targetWidth / 2 == sourceWidth
targetHeightHeight of the target buffer in pixel, with range [2, infinity) and targetHeight / 2 == sourceHeight
sourcePaddingElementsThe number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsThe number of padding elements at the end of each target row, in elements, with range [0, infinity)
workerOptional worker object to distribute the computation
Template Parameters
TThe data type of a pixel channel
tChannelsThe number of data channels, with range [1, infinity)

◆ multiplyByTwoSubset()

template<typename T , unsigned int tChannels>
void Ocean::CV::FrameEnlarger::multiplyByTwoSubset ( const T *  source,
T *  target,
const unsigned int  targetWidth,
const unsigned int  targetHeight,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
const unsigned int  firstTargetRow,
const unsigned int  numberTargetRows 
)
staticprivate

Doubles a subset of a given frame by a pixel repeating upsampling.

Parameters
sourceBuffer of the source frame to be upsampled
targetBuffer of the target frame receiving the upsampled frame
targetWidthWidth of the target buffer in pixel, with range [2, infinity) and targetWidth / 2 == sourceWidth
targetHeightHeight of the target buffer in pixel, with range [2, infinity) and targetHeight / 2 == sourceHeight
sourcePaddingElementsThe number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsThe number of padding elements at the end of each target row, in elements, with range [0, infinity)
firstTargetRowFirst target row to be handled, with range [0, targetHeight)
numberTargetRowsNumber of target rows to be handled, with range [1, targetHeight]
Template Parameters
TThe data type of a pixel channel
tChannelsThe number of data channels, with range [1, infinity)

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