Ocean
Ocean::CV::Canvas Class Reference

This class implements canvas functions. 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...
 
class  FilterFactors
 This class implements a helper class that provides binomial filter parameters for a specific filter size. More...
 
class  Font
 This class implements a standard font similar to a code-block like font. More...
 

Static Public Member Functions

static const uint8_t * white (const FrameType::PixelFormat pixelFormat=FrameType::FORMAT_RGB24)
 Returns the color values for a white color. More...
 
static const uint8_t * black (const FrameType::PixelFormat pixelFormat=FrameType::FORMAT_RGB24)
 Returns the color values for a black color. More...
 
static const uint8_t * gray (const FrameType::PixelFormat pixelFormat=FrameType::FORMAT_RGB24)
 Returns the color values for a gray color. More...
 
static const uint8_t * red (const FrameType::PixelFormat pixelFormat=FrameType::FORMAT_RGB24)
 Returns the color values for a red color. More...
 
static const uint8_t * green (const FrameType::PixelFormat pixelFormat=FrameType::FORMAT_RGB24)
 Returns the color values for a green color. More...
 
static const uint8_t * blue (const FrameType::PixelFormat pixelFormat=FrameType::FORMAT_RGB24)
 Returns the color values for a blue color. More...
 
static const uint8_t * yellow (const FrameType::PixelFormat pixelFormat=FrameType::FORMAT_RGB24)
 Returns the color values for a yellow color. More...
 
static bool line (Frame &frame, const int xStart, const int yStart, const int xEnd, const int yEnd, const uint8_t *value=nullptr)
 Paints a line with specified start and end position with pixel accuracy. More...
 
static bool lines (Frame &frame, const PixelPosition *positions, const unsigned int numberPositions, const uint8_t *value=nullptr)
 Paints several lines with specified start and end positions with pixel accuracy. More...
 
template<unsigned int tChannels>
static void line8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const int xStart, const int yStart, const int xEnd, const int yEnd, const uint8_t *value=nullptr, const unsigned int framePaddingElements=0u)
 Paints a line with specified start and end position with pixel accuracy. More...
 
template<unsigned int tChannels>
static void lines8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const PixelPosition *positions, const unsigned int numberPositions, const uint8_t *value=nullptr, const unsigned int framePaddingElements=0u)
 Paints several lines with specified start and end positions with pixel accuracy. More...
 
template<unsigned int tSize>
static bool line (Frame &frame, const Scalar xStart, const Scalar yStart, const Scalar xEnd, const Scalar yEnd, const uint8_t *value=nullptr)
 Paints a line with specified start and end position with sub-pixel accuracy. More...
 
template<unsigned int tChannels, unsigned int tSize>
static void line8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const Scalar xStart, const Scalar yStart, const Scalar xEnd, const Scalar yEnd, const uint8_t *value=nullptr, const unsigned int framePaddingElements=0u)
 Paints a line with specified start and end position with sub-pixel accuracy. More...
 
template<unsigned int tSize>
static bool line (Frame &frame, const Vector2 &start, const Vector2 &end, const uint8_t *value=nullptr)
 Paints a line with specified start and end position with sub-pixel accuracy. More...
 
template<unsigned int tChannels, unsigned int tSize>
static void line8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const Vector2 &start, const Vector2 &end, const uint8_t *value=nullptr, const unsigned int framePaddingElements=0u)
 Paints a line with specified start and end position with sub-pixel accuracy. More...
 
template<unsigned int tSize>
static bool line (Frame &frame, const FiniteLine2 &line, const uint8_t *value=nullptr)
 Paints a finite line with sub-pixel accuracy. More...
 
template<unsigned int tSize>
static bool lines (Frame &frame, const FiniteLines2 &lines, const uint8_t *value=nullptr)
 Paints several finite lines with sub-pixel accuracy. More...
 
template<unsigned int tChannels, unsigned int tSize>
static void line8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const FiniteLine2 &line, const uint8_t *value=nullptr, const unsigned int framePaddingElements=0u)
 Paints a finite line with sub-pixel accuracy. More...
 
template<unsigned int tSize>
static bool line (Frame &frame, const Line2 &line, const uint8_t *value=nullptr)
 Paints an infinite line with sub-pixel accuracy. More...
 
template<unsigned int tSize>
static bool lines (Frame &frame, const Lines2 &lines, const uint8_t *value=nullptr)
 Paints several infinite lines with sub-pixel accuracy. More...
 
template<unsigned int tChannels, unsigned int tSize>
static void line8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const Line2 &line, const uint8_t *value=nullptr, const unsigned int framePaddingElements=0u)
 Paints an infinite line with sub-pixel accuracy. More...
 
template<unsigned int tSize>
static bool box (Frame &frame, const Box2 &box, const uint8_t *value=nullptr)
 Paints a 2D axis aligned bounding box with sub-pixel accuracy. More...
 
template<unsigned int tChannels, unsigned int tSize>
static void box8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const Box2 &box, const uint8_t *value=nullptr, const unsigned int framePaddingElements=0u)
 Paints a 2D axis aligned bounding box with sub-pixel accuracy. More...
 
static bool ellipse (Frame &frame, const PixelPosition &position, const unsigned int horizontal, const unsigned int vertical, const uint8_t *value=nullptr)
 Paints an ellipse at a specified position with specified size. More...
 
template<unsigned int tChannels>
static void ellipse8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const PixelPosition &position, const unsigned int horizontal, const unsigned int vertical, const uint8_t *value=nullptr, const unsigned int paddingElements=0u)
 Paints an ellipse at a specified position with specified size. More...
 
static bool rotatedEllipse (Frame &frame, const PixelPosition &position, const unsigned int horizontal, const unsigned int vertical, const Scalar angle, const uint8_t *value=nullptr)
 Paints a rotated elliptic region at a specified position with specified size and rotation angle. More...
 
static bool rectangle (Frame &frame, const int left, const int top, const unsigned int xSize, const unsigned int ySize, const uint8_t *value=nullptr)
 Paints a rectangle at a specified position with specified size. More...
 
template<unsigned int tChannels>
static void rectangle8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const int left, const int top, const unsigned int xSize, const unsigned int ySize, const uint8_t *value=nullptr, const unsigned int framePaddingElements=0u)
 Paints a rectangle at a specified position with specified size. More...
 
template<unsigned int tSize, PixelCenter tPixelCenter = CV::PC_CENTER>
static bool point (Frame &frame, const Vector2 &position, const uint8_t *value=nullptr)
 Paints a point with sub-pixel accuracy. More...
 
template<unsigned int tChannels, unsigned int tSize, PixelCenter tPixelCenter = CV::PC_CENTER>
static void point8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const Vector2 &position, const uint8_t *value=nullptr, const unsigned int framePaddingElements=0u)
 Paints a point with sub-pixel accuracy. More...
 
template<unsigned int tSize, PixelCenter tPixelCenter = CV::PC_CENTER>
static bool points (Frame &frame, const Vectors2 &positions, const uint8_t *value=nullptr)
 Paints points with sub-pixel accuracy. More...
 
template<unsigned int tChannels, unsigned int tSize, PixelCenter tPixelCenter = CV::PC_CENTER>
static void points8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const Vectors2 &positions, const uint8_t *value=nullptr, const unsigned int framePaddingElements=0u)
 Paints points with sub-pixel accuracy. More...
 
static bool fill (Frame &frame, const PixelPosition &position, const uint8_t *value=nullptr)
 Fills an image area with a given color, an recursive seed-fill-algorithm is implemented. More...
 
template<unsigned int tChannels>
static void fill8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const PixelPosition &position, const uint8_t *value=nullptr, const unsigned int framePaddingElements=0u)
 Fills an image area with a given color, an recursive seed-fill-algorithm is implemented. More...
 
template<unsigned int tSize>
static bool polygon (Frame &frame, const Vector2 *points, size_t numberPoints, const uint8_t *value=nullptr, const bool closeLoop=true)
 Paints the outline of a polygon with sub-pixel accuracy. More...
 
template<unsigned int tChannels, unsigned int tSize>
static void polygon8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const Vector2 *points, size_t numberPoints, const uint8_t *value=nullptr, const bool closeLoop=true, const unsigned int framePaddingElements=0u)
 Paints the outline of a polygon with sub-pixel accuracy. More...
 
static bool drawText (Frame &frame, const std::string &text, const int left, const int top, const uint8_t *foregroundColor, const uint8_t *backgroundColor=nullptr)
 Paints a given text into a given frame using the standard (code style) font supporting only one size. More...
 
static bool textExtent (const std::string &text, unsigned int &width, unsigned int &height)
 Returns the bounding box a given text will occupy in pixel space when using the standard font. More...
 

Static Private Member Functions

static const uint8_t * memoryBlock32Byte ()
 Returns a memory block to 32 bytes as a backup in case a requested color value does not exist for a specific pixel format. More...
 
template<typename T , unsigned int tChannels>
static void ellipse8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const PixelPosition &position, const unsigned int horizontalHalf, const unsigned int verticalHalf, const uint8_t *value, const unsigned int paddingElements=0u)
 Paints a ellipse at a specified position with specified size. More...
 
template<unsigned int tChannels>
static void rotatedEllipse8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const PixelPosition &position, const unsigned int horizontalHalf, const unsigned int verticalHalf, const Scalar angle, const uint8_t *value, const unsigned int paddingElements=0u)
 Paints a rotated elliptic region at a specified position with specified size. More...
 
template<unsigned int tChannels, unsigned int tSize, PixelCenter tPixelCenter>
static void point8BitPerChannel (uint8_t *frame, const unsigned int width, const unsigned int height, const Vector2 &position, const uint8_t *value, const FilterFactors< tSize > &factors, const unsigned int framePaddingElements=0u)
 Paints a point with sub-pixel accuracy. More...
 

Detailed Description

This class implements canvas functions.

Member Function Documentation

◆ black()

static const uint8_t* Ocean::CV::Canvas::black ( const FrameType::PixelFormat  pixelFormat = FrameType::FORMAT_RGB24)
static

Returns the color values for a black color.

Values of alpha channel are set to 0xFF.

Parameters
pixelFormatThe pixel format for which the color will be returned
Returns
The requested color value matching with the pixel format

◆ blue()

static const uint8_t* Ocean::CV::Canvas::blue ( const FrameType::PixelFormat  pixelFormat = FrameType::FORMAT_RGB24)
static

Returns the color values for a blue color.

Values of alpha channel are set to 0xFF.

Parameters
pixelFormatThe pixel format for which the color will be returned
Returns
The requested color value matching with the pixel format

◆ box()

template<unsigned int tSize>
bool Ocean::CV::Canvas::box ( Frame frame,
const Box2 box,
const uint8_t *  value = nullptr 
)
static

Paints a 2D axis aligned bounding box with sub-pixel accuracy.

Parameters
frameThe frame in which the line will be painted, must be valid
boxThe 2D axis aligned bounding box to be drawn, must be valid
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
Returns
True, if succeeded
Template Parameters
tSizeSize (thickness) of the line in pixel, with range [1, infinity) and must be odd
See also
lines8BitPerChannel().

◆ box8BitPerChannel()

template<unsigned int tChannels, unsigned int tSize>
void Ocean::CV::Canvas::box8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const Box2 box,
const uint8_t *  value = nullptr,
const unsigned int  framePaddingElements = 0u 
)
static

Paints a 2D axis aligned bounding box with sub-pixel accuracy.

Parameters
frameThe frame receiving the line, must be valid
widthThe width of the frame in pixel, with range [1, infinity)
heightThe height of the frame in pixel, with range [1, infinity)
boxThe 2D axis aligned bounding box to be drawn, must be valid
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
framePaddingElementsOptional number of padding elements at the end of each row, with range [0, infinity)
Template Parameters
tChannelsNumber of channels of the given frame, with range [1, infinity)
tSizeSize (thickness) of the line in pixel, with range [1, infinity) and must be odd
See also
lines8BitPerChannel().

◆ drawText()

static bool Ocean::CV::Canvas::drawText ( Frame frame,
const std::string &  text,
const int  left,
const int  top,
const uint8_t *  foregroundColor,
const uint8_t *  backgroundColor = nullptr 
)
static

Paints a given text into a given frame using the standard (code style) font supporting only one size.

Use Ocean::CV::Fonts in case arbitrary fonts are necessary. The given location can be partially outside of the frame.

Parameters
frameThe frame in which the text will be painted, must have a generic pixel format like e.g., FORMAT_Y8 or FORMAT_RGB24, must be valid
textThe text to be painted, the text can contain end-of-line characters to paint the remaining the following characters in the next line, can be empty
leftThe horizontal start position of the text within the frame, in pixel, with range (-infinity, infinity)
topThe vertical start position of the text within the frame, in pixel, with range (-infinity, infinity)
foregroundColorThe foreground color to be used when painting the character, must be valid
backgroundColorThe optional background color to be used when paining the character, nullptr to paint the foreground pixels only
Returns
True, if succeeded
See also
textExtent(), CV::Fonts::Font::drawText().

◆ ellipse()

static bool Ocean::CV::Canvas::ellipse ( Frame frame,
const PixelPosition position,
const unsigned int  horizontal,
const unsigned int  vertical,
const uint8_t *  value = nullptr 
)
static

Paints an ellipse at a specified position with specified size.

Parameters
frameThe frame receiving the elliptic blob-region, must be valid
positionCenter position of the elliptic mask, with range [0, frame.width())x[0, frame.height())
horizontalThe horizontal size of the elliptic mask in pixel, must be odd, with range [3, infinity)
verticalThe vertical size of the elliptic mask in pixel, must be odd, with range [3, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
Returns
True, if succeeded
See also
ellipse8BitPerChannel().

◆ ellipse8BitPerChannel() [1/2]

template<unsigned int tChannels>
void Ocean::CV::Canvas::ellipse8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const PixelPosition position,
const unsigned int  horizontal,
const unsigned int  vertical,
const uint8_t *  value = nullptr,
const unsigned int  paddingElements = 0u 
)
inlinestatic

Paints an ellipse at a specified position with specified size.

Parameters
frameThe frame receiving the elliptic blob-region, must be valid
widthThe width of the mask frame in pixel, with range [1, infinity)
heightThe height of the mask frame in pixel, with range [1, infinity)
positionCenter position of the elliptic mask, with range [0, width)x[0, height)
horizontalThe horizontal size of the elliptic mask, must be odd, with range [3, infinity)
verticalThe vertical size of the elliptic mask, must be odd, with range [3, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
paddingElementsOptional number of padding elements at the end of each row, with range [0, infinity)
Template Parameters
tChannelsNumber of data channels of the frame data
See also
ellipse().

◆ ellipse8BitPerChannel() [2/2]

template<typename T , unsigned int tChannels>
void Ocean::CV::Canvas::ellipse8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const PixelPosition position,
const unsigned int  horizontalHalf,
const unsigned int  verticalHalf,
const uint8_t *  value,
const unsigned int  paddingElements = 0u 
)
staticprivate

Paints a ellipse at a specified position with specified size.

Parameters
frameThe frame receiving the elliptic blob-region, must be valid
widthThe width of the mask frame in pixel, with range [1, infinity)
heightThe height of the mask frame in pixel, with range [1, infinity)
positionCenter position of the elliptic mask, with range [0, width - 1]x[0, height - 1]
horizontalHalfHalf horizontal size of the elliptic mask, with range [1, infinity)
verticalHalfHalf vertical size of the elliptic mask, with range [1, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
paddingElementsOptional number of padding elements at the end of each row, with range [0, infinity)
Template Parameters
TInternal data type to determine the elliptic region
tChannelsNumber of channels of the given frame

◆ fill()

static bool Ocean::CV::Canvas::fill ( Frame frame,
const PixelPosition position,
const uint8_t *  value = nullptr 
)
static

Fills an image area with a given color, an recursive seed-fill-algorithm is implemented.

The fill area is determined by all pixels that lie in a successive 4-neighborhood of the given start position and have the same color value as the start pixel.

Parameters
frameThe frame to be filled
positionThe start position defining the color of the fill area, with range [0, width)x[0, height)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
Returns
True, if succeeded

◆ fill8BitPerChannel()

template<unsigned int tChannels>
void Ocean::CV::Canvas::fill8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const PixelPosition position,
const uint8_t *  value = nullptr,
const unsigned int  framePaddingElements = 0u 
)
static

Fills an image area with a given color, an recursive seed-fill-algorithm is implemented.

The fill area is determined by all pixels that lie in a successive 4-neighborhood of the given start position and have the same color value as the start pixel.

Parameters
frameThe frame to be filled, must be valid
widthThe width of the frame in pixel, with range [1, infinity)
heightThe height of the frame in pixel, with range [1, infinity)
positionThe start position defining the color of the fill area, with range [0, width)x[0, height)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
framePaddingElementsOptional number of padding elements at the end of each frame row, in elements, with range [0, infinity)
Template Parameters
tChannelsNumber of frame channels, with range [1, infinity)

◆ gray()

static const uint8_t* Ocean::CV::Canvas::gray ( const FrameType::PixelFormat  pixelFormat = FrameType::FORMAT_RGB24)
static

Returns the color values for a gray color.

Values of alpha channel are set to 0xFF.

Parameters
pixelFormatThe pixel format for which the color will be returned
Returns
The requested color value matching with the pixel format

◆ green()

static const uint8_t* Ocean::CV::Canvas::green ( const FrameType::PixelFormat  pixelFormat = FrameType::FORMAT_RGB24)
static

Returns the color values for a green color.

Values of alpha channel are set to 0xFF.

Parameters
pixelFormatThe pixel format for which the color will be returned
Returns
The requested color value matching with the pixel format

◆ line() [1/5]

template<unsigned int tSize>
bool Ocean::CV::Canvas::line ( Frame frame,
const FiniteLine2 line,
const uint8_t *  value = nullptr 
)
static

Paints a finite line with sub-pixel accuracy.

The specified start and end positions will be included.

Parameters
frameThe frame in which the line will be painted, must be valid
lineThe finite line to be drawn, must be valid
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
Returns
True, if succeeded
Template Parameters
tSizeSize (thickness) of the line in pixel, with range [1, infinity) and must be odd
See also
lines8BitPerChannel().

◆ line() [2/5]

static bool Ocean::CV::Canvas::line ( Frame frame,
const int  xStart,
const int  yStart,
const int  xEnd,
const int  yEnd,
const uint8_t *  value = nullptr 
)
static

Paints a line with specified start and end position with pixel accuracy.

The specified start and end positions will be included.

Parameters
frameThe frame in which the line will be painted, must be valid
xStartHorizontal start position, with range (-infinity, infinity)
yStartVertical start position, with range (-infinity, infinity)
xEndHorizontal end position, with range (-infinity, infinity)
yEndVertical end position, with range (-infinity, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
See also
lines().

◆ line() [3/5]

template<unsigned int tSize>
bool Ocean::CV::Canvas::line ( Frame frame,
const Line2 line,
const uint8_t *  value = nullptr 
)
static

Paints an infinite line with sub-pixel accuracy.

Parameters
frameThe frame in which the line will be painted, must be valid
lineThe line to be drawn, must be valid
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
Returns
True, if succeeded
Template Parameters
tSizeSize (thickness) of the line in pixel, with range [1, infinity) and must be odd
See also
lines8BitPerChannel().

◆ line() [4/5]

template<unsigned int tSize>
bool Ocean::CV::Canvas::line ( Frame frame,
const Scalar  xStart,
const Scalar  yStart,
const Scalar  xEnd,
const Scalar  yEnd,
const uint8_t *  value = nullptr 
)
static

Paints a line with specified start and end position with sub-pixel accuracy.

The specified start and end positions will be included.

Parameters
frameThe frame in which the line will be painted, must be valid
xStartHorizontal start position, with range (-infinity, infinity)
yStartVertical start position, with range (-infinity, infinity)
xEndHorizontal end position, with range (-infinity, infinity)
yEndVertical end position, with range (-infinity, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
Returns
True, if succeeded
Template Parameters
tSizeSize (thickness) of the line in pixel, with range [1, infinity) and must be odd
See also
lines().

◆ line() [5/5]

template<unsigned int tSize>
bool Ocean::CV::Canvas::line ( Frame frame,
const Vector2 start,
const Vector2 end,
const uint8_t *  value = nullptr 
)
static

Paints a line with specified start and end position with sub-pixel accuracy.

The specified start and end positions will be included.

Parameters
frameThe frame in which the line will be painted, must be valid
startThe start position, with range (-infinity, infinity)x(-infinity, infinity)
endThe end position, with range (-infinity, infinity)x(-infinity, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
Returns
True, if succeeded
Template Parameters
tSizeSize (thickness) of the line in pixel, with range [1, infinity) and must be odd
See also
lines().

◆ line8BitPerChannel() [1/5]

template<unsigned int tChannels, unsigned int tSize>
void Ocean::CV::Canvas::line8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const FiniteLine2 line,
const uint8_t *  value = nullptr,
const unsigned int  framePaddingElements = 0u 
)
static

Paints a finite line with sub-pixel accuracy.

The specified start and end positions will be included.

Parameters
frameThe frame receiving the line, must be valid
widthThe width of the frame in pixel, with range [1, infinity)
heightThe height of the frame in pixel, with range [1, infinity)
lineThe finite line to be drawn, must be valid
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
framePaddingElementsOptional number of padding elements at the end of each row, with range [0, infinity)
Template Parameters
tChannelsNumber of channels of the given frame, with range [1, infinity)
tSizeSize (thickness) of the line in pixel, with range [1, infinity) and must be odd
See also
lines8BitPerChannel().

◆ line8BitPerChannel() [2/5]

template<unsigned int tChannels>
void Ocean::CV::Canvas::line8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const int  xStart,
const int  yStart,
const int  xEnd,
const int  yEnd,
const uint8_t *  value = nullptr,
const unsigned int  framePaddingElements = 0u 
)
static

Paints a line with specified start and end position with pixel accuracy.

The specified start and end positions will be included.

Parameters
frameThe frame in which the line will be painted, must be valid
widthThe width of the frame in pixel, with range [1, infinity)
heightThe height of the frame in pixel, with range [1, infinity)
xStartHorizontal start position, with range (-infinity, infinity)
yStartVertical start position, with range (-infinity, infinity)
xEndHorizontal end position, with range (-infinity, infinity)
yEndVertical end position, with range (-infinity, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
framePaddingElementsOptional number of padding elements at the end of each row, in elements, with range [0, infinity)
Template Parameters
tChannelsNumber of channels of the given frame, with range [1, infinity)
See also
lines8BitPerChannel().

◆ line8BitPerChannel() [3/5]

template<unsigned int tChannels, unsigned int tSize>
void Ocean::CV::Canvas::line8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const Line2 line,
const uint8_t *  value = nullptr,
const unsigned int  framePaddingElements = 0u 
)
static

Paints an infinite line with sub-pixel accuracy.

Parameters
frameThe frame receiving the line, must be valid
widthThe width of the frame in pixel, with range [1, infinity)
heightThe height of the frame in pixel, with range [1, infinity)
lineThe line to be drawn, must be valid
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
framePaddingElementsOptional number of padding elements at the end of each row, with range [0, infinity)
Template Parameters
tChannelsNumber of channels of the given frame, with range [1, infinity)
tSizeSize (thickness) of the line in pixel, with range [1, infinity) and must be odd
See also
lines8BitPerChannel().

◆ line8BitPerChannel() [4/5]

template<unsigned int tChannels, unsigned int tSize>
void Ocean::CV::Canvas::line8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const Scalar  xStart,
const Scalar  yStart,
const Scalar  xEnd,
const Scalar  yEnd,
const uint8_t *  value = nullptr,
const unsigned int  framePaddingElements = 0u 
)
static

Paints a line with specified start and end position with sub-pixel accuracy.

The specified start and end positions will be included.

Parameters
frameThe frame receiving the line, must be valid
widthThe width of the frame in pixel, with range [1, infinity)
heightThe height of the frame in pixel, with range [1, infinity)
xStartHorizontal start position, with range (-infinity, infinity)
yStartVertical start position, with range (-infinity, infinity)
xEndHorizontal end position, with range (-infinity, infinity)
yEndVertical end position, with range (-infinity, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
framePaddingElementsOptional number of padding elements at the end of each row, with range [0, infinity)
Template Parameters
tChannelsNumber of channels of the given frame, with range [1, infinity)
tSizeSize (thickness) of the line in pixel, with range [1, infinity) and must be odd
See also
lines8BitPerChannel().

◆ line8BitPerChannel() [5/5]

template<unsigned int tChannels, unsigned int tSize>
void Ocean::CV::Canvas::line8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const Vector2 start,
const Vector2 end,
const uint8_t *  value = nullptr,
const unsigned int  framePaddingElements = 0u 
)
static

Paints a line with specified start and end position with sub-pixel accuracy.

The specified start and end positions will be included.

Parameters
frameThe frame receiving the line, must be valid
widthThe width of the frame in pixel, with range [1, infinity)
heightThe height of the frame in pixel, with range [1, infinity)
startThe start position, with range (-infinity, infinity)x(-infinity, infinity)
endThe end position, with range (-infinity, infinity)x(-infinity, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
framePaddingElementsOptional number of padding elements at the end of each row, with range [0, infinity)
Template Parameters
tChannelsNumber of channels of the given frame, with range [1, infinity)
tSizeSize (thickness) of the line in pixel, with range [1, infinity) and must be odd
See also
lines8BitPerChannel().

◆ lines() [1/3]

template<unsigned int tSize>
bool Ocean::CV::Canvas::lines ( Frame frame,
const FiniteLines2 lines,
const uint8_t *  value = nullptr 
)
inlinestatic

Paints several finite lines with sub-pixel accuracy.

The specified start and end positions will be included.

Parameters
frameThe frame in which the line will be painted, must be valid
linesThe finite lines to be drawn, must be valid
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
Returns
True, if succeeded
Template Parameters
tSizeSize (thickness) of the line in pixel, with range [1, infinity) and must be odd
See also
line().

◆ lines() [2/3]

template<unsigned int tSize>
bool Ocean::CV::Canvas::lines ( Frame frame,
const Lines2 lines,
const uint8_t *  value = nullptr 
)
inlinestatic

Paints several infinite lines with sub-pixel accuracy.

Parameters
frameThe frame in which the line will be painted, must be valid
linesThe lines to be drawn, must be valid
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
Returns
True, if succeeded
Template Parameters
tSizeSize (thickness) of the line in pixel, with range [1, infinity) and must be odd
See also
line().

◆ lines() [3/3]

static bool Ocean::CV::Canvas::lines ( Frame frame,
const PixelPosition positions,
const unsigned int  numberPositions,
const uint8_t *  value = nullptr 
)
static

Paints several lines with specified start and end positions with pixel accuracy.

The specified start and end positions will be included.

Parameters
frameThe frame in which the line will be painted, must be valid
positionsInterleaved start and end positions of the lines, with range (-infinity, infinity)x(-infinity, infinity)
numberPositionsNumber of provided positions, should be even - otherwise the last line will not be painted
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
Returns
True, if succeeded
See also
line().

◆ lines8BitPerChannel()

template<unsigned int tChannels>
void Ocean::CV::Canvas::lines8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const PixelPosition positions,
const unsigned int  numberPositions,
const uint8_t *  value = nullptr,
const unsigned int  framePaddingElements = 0u 
)
static

Paints several lines with specified start and end positions with pixel accuracy.

The specified start and end positions will be included.

Parameters
frameThe frame in which the line will be painted, must be valid
widthThe width of the frame in pixel, with range [0, infinity)
heightThe height of the frame in pixel, with range [0, infinity)
positionsInterleaved start and end positions of the lines, with range (-infinity, infinity)x(-infinity, infinity)
numberPositionsNumber of provided positions, should be even - otherwise the last line will not be painted
valueColor value to be used, nullptr to apply 0x00 for each channel
framePaddingElementsOptional number of padding elements at the end of each row, with range [0, infinity)
Template Parameters
tChannelsNumber of channels of the given frame, with range [1, infinity)
See also
line8BitPerChannel().

◆ memoryBlock32Byte()

static const uint8_t* Ocean::CV::Canvas::memoryBlock32Byte ( )
staticprivate

Returns a memory block to 32 bytes as a backup in case a requested color value does not exist for a specific pixel format.

Returns
The 32 byte memory block

◆ point()

template<unsigned int tSize, PixelCenter tPixelCenter>
bool Ocean::CV::Canvas::point ( Frame frame,
const Vector2 position,
const uint8_t *  value = nullptr 
)
static

Paints a point with sub-pixel accuracy.

Parameters
frameThe frame in which the point will be painted, must be valid
positionSub-pixel position of the point, with range (-infinity, infinity)x(-infinity, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
Returns
True, if succeeded
Template Parameters
tSizeThe size (width) of the point in pixel, with range [1, infinity) and must be odd
tPixelCenterThe pixel center of the provided position, either 'PC_TOP_LEFT' or 'PC_CENTER'

◆ point8BitPerChannel() [1/2]

template<unsigned int tChannels, unsigned int tSize, PixelCenter tPixelCenter>
void Ocean::CV::Canvas::point8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const Vector2 position,
const uint8_t *  value,
const FilterFactors< tSize > &  factors,
const unsigned int  framePaddingElements = 0u 
)
staticprivate

Paints a point with sub-pixel accuracy.

Parameters
frameThe frame in which the point will be painted
widthThe width of the frame in pixel, with range [1, infinity)
heightThe height of the frame in pixel, with range [1, infinity)
positionSub-pixel position of the point, with range (-infinity, infinity)x(-infinity, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
factorsFilter factors for the specified point size
framePaddingElementsOptional number of padding elements at the end of each frame row, in elements, with range [0, infinity)
Template Parameters
tChannelsNumber of frame channels, with range [1, infinity)
tSizeThe size (width) of the point in pixel, with range [1, infinity) and must be odd
tPixelCenterThe pixel center of the provided position, either 'PC_TOP_LEFT' or 'PC_CENTER'

◆ point8BitPerChannel() [2/2]

template<unsigned int tChannels, unsigned int tSize, PixelCenter tPixelCenter>
void Ocean::CV::Canvas::point8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const Vector2 position,
const uint8_t *  value = nullptr,
const unsigned int  framePaddingElements = 0u 
)
static

Paints a point with sub-pixel accuracy.

Parameters
frameThe frame in which the point will be painted
widthThe width of the frame in pixel, with range [1, infinity)
heightThe height of the frame in pixel, with range [1, infinity)
positionSub-pixel position of the point, with range (-infinity, infinity)x(-infinity, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
framePaddingElementsOptional number of padding elements at the end of each frame row, in elements, with range [0, infinity)
Template Parameters
tChannelsNumber of frame channels, with range [1, infinity)
tSizeThe size (width) of the point in pixel, with range [1, infinity) and must be odd
tPixelCenterThe pixel center of the provided position, either 'PC_TOP_LEFT' or 'PC_CENTER'

◆ points()

template<unsigned int tSize, PixelCenter tPixelCenter>
bool Ocean::CV::Canvas::points ( Frame frame,
const Vectors2 positions,
const uint8_t *  value = nullptr 
)
static

Paints points with sub-pixel accuracy.

Parameters
frameThe frame in which the point will be painted, must be valid
positionsSub-pixel positions of the points, with range (-infinity, infinity)x(-infinity, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
Returns
True, if succeeded
Template Parameters
tSizeThe size (width) of the point in pixel, with range [1, infinity) and must be odd
tPixelCenterThe pixel center of the provided position, either 'PC_TOP_LEFT' or 'PC_CENTER'

◆ points8BitPerChannel()

template<unsigned int tChannels, unsigned int tSize, PixelCenter tPixelCenter>
void Ocean::CV::Canvas::points8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const Vectors2 positions,
const uint8_t *  value = nullptr,
const unsigned int  framePaddingElements = 0u 
)
static

Paints points with sub-pixel accuracy.

Parameters
frameThe frame in which the point will be painted
widthThe width of the frame in pixel, with range [1, infinity)
heightThe height of the frame in pixel, with range [1, infinity)
positionsSub-pixel positions of the points, with range (-infinity, infinity)x(-infinity, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
framePaddingElementsOptional number of padding elements at the end of each frame row, in elements, with range [0, infinity)
Template Parameters
tChannelsNumber of frame channels, with range [1, infinity)
tSizeThe size (width) of the point in pixel, with range [1, infinity) and must be odd
tPixelCenterThe pixel center of the provided position, either 'PC_TOP_LEFT' or 'PC_CENTER'

◆ polygon()

template<unsigned int tSize>
bool Ocean::CV::Canvas::polygon ( Frame frame,
const Vector2 points,
size_t  numberPoints,
const uint8_t *  value = nullptr,
const bool  closeLoop = true 
)
static

Paints the outline of a polygon with sub-pixel accuracy.

Parameters
frameThe frame in which the polygon will be painted, must be valid
pointsThe points of the polygon to be drawn, must be valid
numberPointsThe number of given polygon points, with range [0, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
closeLoopTrue, to close the loop of the polygon (between first and last point); False, to not paint the connection between first and last point
Returns
True, if succeeded
Template Parameters
tSizeSize (thickness) of the line in pixel, with range [1, infinity) and must be odd

◆ polygon8BitPerChannel()

template<unsigned int tChannels, unsigned int tSize>
void Ocean::CV::Canvas::polygon8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const Vector2 points,
size_t  numberPoints,
const uint8_t *  value = nullptr,
const bool  closeLoop = true,
const unsigned int  framePaddingElements = 0u 
)
static

Paints the outline of a polygon with sub-pixel accuracy.

Parameters
frameThe frame in which the polygon will be painted, must be valid
widthThe width of the frame in pixel, with range [1, infinity)
heightThe height of the frame in pixel, with range [1, infinity)
pointsThe points of the polygon to be drawn, must be valid
numberPointsThe number of given polygon points, with range [0, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
closeLoopTrue, to close the loop of the polygon (between first and last point); False, to not paint the connection between first and last point
framePaddingElementsOptional number of padding elements at the end of each frame row, in elements, with range [0, infinity)
Template Parameters
tChannelsNumber of frame channels, with range [1, infinity)
tSizeSize (thickness) of the line in pixel, with range [1, infinity) and must be odd

◆ rectangle()

static bool Ocean::CV::Canvas::rectangle ( Frame frame,
const int  left,
const int  top,
const unsigned int  xSize,
const unsigned int  ySize,
const uint8_t *  value = nullptr 
)
static

Paints a rectangle at a specified position with specified size.

Parameters
frameThe frame receiving the rectangle, must be valid
leftHorizontal start position (top, left) of the rectangle in pixel, with range (-infinity, infinity)
topVertical start position (top, left) of the rectangle in pixel, with range (-infinity, infinity)
xSizeWidth of the rectangle in pixel, with range [0u, infinity)
ySizeHeight of the rectangle in pixel, with range [0u, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
Returns
True, if succeeded

◆ rectangle8BitPerChannel()

template<unsigned int tChannels>
void Ocean::CV::Canvas::rectangle8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const int  left,
const int  top,
const unsigned int  xSize,
const unsigned int  ySize,
const uint8_t *  value = nullptr,
const unsigned int  framePaddingElements = 0u 
)
static

Paints a rectangle at a specified position with specified size.

Parameters
frameThe frame receiving the rectangle, must be valid
widthThe width of the frame in pixel, with range [1u, infinity)
heightThe height of the frame in pixel, with range [1u, infinity)
leftHorizontal start position (top, left) of the rectangle in pixel, with range (-infinity, infinity)
topVertical start position (top, left) of the rectangle in pixel, with range (-infinity, infinity)
xSizeWidth of the rectangle in pixel, with range [0u, infinity)
ySizeHeight of the rectangle in pixel, with range [0u, infinity)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
framePaddingElementsNumber of padding elements at the end of each frame row, in elements, with range [0, infinity)
Template Parameters
tChannelsNumber of data channels of the frame data, with range [1, infinity)

◆ red()

static const uint8_t* Ocean::CV::Canvas::red ( const FrameType::PixelFormat  pixelFormat = FrameType::FORMAT_RGB24)
static

Returns the color values for a red color.

Values of alpha channel are set to 0xFF.

Parameters
pixelFormatThe pixel format for which the color will be returned
Returns
The requested color value matching with the pixel format

◆ rotatedEllipse()

static bool Ocean::CV::Canvas::rotatedEllipse ( Frame frame,
const PixelPosition position,
const unsigned int  horizontal,
const unsigned int  vertical,
const Scalar  angle,
const uint8_t *  value = nullptr 
)
static

Paints a rotated elliptic region at a specified position with specified size and rotation angle.

Parameters
frameThe frame receiving the elliptic blob-region, must be valid
positionCenter position of the elliptic mask, with range [0, frame.width())x[0, frame.height())
horizontalThe horizontal size of the elliptic mask in pixel, must be odd, with range [3, infinity)
verticalThe vertical size of the elliptic mask in pixel, must be odd, with range [3, infinity)
angleRotation angle, in radian
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
Returns
True, if succeeded
See also
ellipse8BitPerChannel().

◆ rotatedEllipse8BitPerChannel()

template<unsigned int tChannels>
void Ocean::CV::Canvas::rotatedEllipse8BitPerChannel ( uint8_t *  frame,
const unsigned int  width,
const unsigned int  height,
const PixelPosition position,
const unsigned int  horizontalHalf,
const unsigned int  verticalHalf,
const Scalar  angle,
const uint8_t *  value,
const unsigned int  paddingElements = 0u 
)
staticprivate

Paints a rotated elliptic region at a specified position with specified size.

Parameters
frameThe frame receiving the elliptic blob-region, must be valid
widthThe width of the mask frame in pixel, with range [1, infinity)
heightThe height of the mask frame in pixel, with range [1, infinity)
positionCenter position of the elliptic mask, with range [0, width)x[0, height)
horizontalHalfHalf horizontal size of the elliptic mask, with range [1, infinity)
verticalHalfHalf vertical size of the elliptic mask, with range [1, infinity)
angleRotation angle, in radian, with range [0, 2 * PI)
valueColor value to be used, make sure that the provided buffer has at least as many bytes as the pixel format for one pixel, nullptr to apply 0x00 for each channel
paddingElementsOptional number of padding elements at the end of each row, with range [0, infinity)
Template Parameters
tChannelsNumber of channels of the given frame

◆ textExtent()

static bool Ocean::CV::Canvas::textExtent ( const std::string &  text,
unsigned int &  width,
unsigned int &  height 
)
static

Returns the bounding box a given text will occupy in pixel space when using the standard font.

Parameters
textThe text for which the extent will be determined, can be empty
widthThe width of the bounding box, in pixel, with range [0, infinity)
heightThe height of the bounding box, in pixel, with range [0, infinity)
Returns
True, if succeeded
See also
drawText(), CV::Fonts::Font::textExtent().

◆ white()

static const uint8_t* Ocean::CV::Canvas::white ( const FrameType::PixelFormat  pixelFormat = FrameType::FORMAT_RGB24)
static

Returns the color values for a white color.

Values of alpha channel are set to 0xFF.

Parameters
pixelFormatThe pixel format for which the color will be returned
Returns
The requested color value matching with the pixel format

◆ yellow()

static const uint8_t* Ocean::CV::Canvas::yellow ( const FrameType::PixelFormat  pixelFormat = FrameType::FORMAT_RGB24)
static

Returns the color values for a yellow color.

Values of alpha channel are set to 0xFF.

Parameters
pixelFormatThe pixel format for which the color will be returned
Returns
The requested color value matching with the pixel format

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