Ocean
Ocean::CV::SubRegion Class Reference

This class implement a sub-region either defined by 2D triangles or defined by a binary mask. More...

Public Member Functions

 SubRegion ()
 Creates an empty sub-region. More...
 
 SubRegion (const SubRegion &subRegion)
 Copy constructor. More...
 
 SubRegion (SubRegion &&subRegion) noexcept
 Move constructor. More...
 
 SubRegion (const Triangles2 &triangles)
 Creates a sub-region object by a given set of 2D triangles. More...
 
 SubRegion (const Triangle2 *triangles, const size_t size)
 Creates a sub-region object by a given set of 2D triangles. More...
 
 SubRegion (const Frame &mask, const PixelBoundingBox &boundingBox=PixelBoundingBox(), const uint8_t maskValue=0x00)
 Creates a sub-region object by a given binary mask. More...
 
 SubRegion (Frame &&mask, const PixelBoundingBox &boundingBox=PixelBoundingBox(), const uint8_t maskValue=0x00)
 Creates a sub-region object by a given binary mask. More...
 
 SubRegion (const Scalar left, const Scalar top, const Scalar width, const Scalar height)
 Creates a rectangular sub-region which will be handled (internally) as two triangles with one common edge. More...
 
 SubRegion (const Box2 &boundingBox)
 Creates a rectangular sub-region which will be handled (internally) as two triangles with one common edge. More...
 
 SubRegion (const PixelBoundingBox &boundingBox)
 Creates a rectangular sub-region which will be handled (internally) as two triangles with one common edge. More...
 
const Box2boundingBox () const
 Returns the bounding box of this sub-region. More...
 
bool isInside (const Vector2 &point) const
 Returns whether a given point lies inside this sub-region. More...
 
Vectors2 filterPoints (const Vectors2 &points) const
 Filters a set of given image points so that all resulting points ly inside this sub-region. More...
 
bool isEmpty () const
 Returns whether this sub-region is empty. More...
 
const Framemask () const
 Returns the binary sub-region mask, if any. More...
 
const Triangles2triangles () const
 Returns the 2D triangles of this sub-region, if any. More...
 
Scalar size () const
 Returns the number of pixels that are covered by this region. More...
 
SubRegionoperator= (const SubRegion &subRegion)
 Assign operator. More...
 
SubRegionoperator= (SubRegion &&subRegion) noexcept
 Move operator. More...
 
SubRegion operator* (const Scalar factor) const
 Increases or decreases a sub-region by application of a scalar multiplication factor. More...
 
SubRegion operator* (const SquareMatrix3 &homography) const
 Transforms a sub-region by application of a homography that transforms points in the initial frame to points in the new frame. More...
 
 operator bool () const
 Returns whether this sub-region is not empty. More...
 

Private Attributes

Triangles2 triangles_
 A set of 2D triangles defining the sub-region. More...
 
Frame mask_
 A binary frame defining the sub-region per pixel. More...
 
uint8_t maskValue_ = 0x00u
 The pixel value defining the sub-region. More...
 
Box2 boundingBox_
 Bounding box of this sub-region. More...
 

Detailed Description

This class implement a sub-region either defined by 2D triangles or defined by a binary mask.

Constructor & Destructor Documentation

◆ SubRegion() [1/10]

Ocean::CV::SubRegion::SubRegion ( )
inline

Creates an empty sub-region.

◆ SubRegion() [2/10]

Ocean::CV::SubRegion::SubRegion ( const SubRegion subRegion)
inline

Copy constructor.

Parameters
subRegionSub-region object to be copied

◆ SubRegion() [3/10]

Ocean::CV::SubRegion::SubRegion ( SubRegion &&  subRegion)
inlinenoexcept

Move constructor.

Parameters
subRegionSub-region object to be moved

◆ SubRegion() [4/10]

Ocean::CV::SubRegion::SubRegion ( const Triangles2 triangles)
explicit

Creates a sub-region object by a given set of 2D triangles.

Parameters
triangles2D triangles defining the sub-region

◆ SubRegion() [5/10]

Ocean::CV::SubRegion::SubRegion ( const Triangle2 triangles,
const size_t  size 
)

Creates a sub-region object by a given set of 2D triangles.

Parameters
triangles2D triangles defining the sub-region
sizeThe number of given triangles

◆ SubRegion() [6/10]

Ocean::CV::SubRegion::SubRegion ( const Frame mask,
const PixelBoundingBox boundingBox = PixelBoundingBox(),
const uint8_t  maskValue = 0x00 
)
explicit

Creates a sub-region object by a given binary mask.

Parameters
maskBinary mask defining the sub-region
boundingBoxOptional bounding box of the sub-region
maskValueThe mask value defining the valid pixels

◆ SubRegion() [7/10]

Ocean::CV::SubRegion::SubRegion ( Frame &&  mask,
const PixelBoundingBox boundingBox = PixelBoundingBox(),
const uint8_t  maskValue = 0x00 
)
explicit

Creates a sub-region object by a given binary mask.

Parameters
maskBinary mask defining the sub-region
boundingBoxOptional bounding box of the sub-region
maskValueThe mask value defining the valid pixels

◆ SubRegion() [8/10]

Ocean::CV::SubRegion::SubRegion ( const Scalar  left,
const Scalar  top,
const Scalar  width,
const Scalar  height 
)

Creates a rectangular sub-region which will be handled (internally) as two triangles with one common edge.

Parameters
leftHorizontal start position of the sub-region
topVertical start position of the sub-region
widthThe width of the sub-region, with range (0, infinity)
heightThe height of the sub-region, with range (0, infinity)

◆ SubRegion() [9/10]

Ocean::CV::SubRegion::SubRegion ( const Box2 boundingBox)
explicit

Creates a rectangular sub-region which will be handled (internally) as two triangles with one common edge.

If the given bounding box is invalid the new sub-region will be a default sub-region.

Parameters
boundingBoxBounding box that will defined the sub-region

◆ SubRegion() [10/10]

Ocean::CV::SubRegion::SubRegion ( const PixelBoundingBox boundingBox)
explicit

Creates a rectangular sub-region which will be handled (internally) as two triangles with one common edge.

If the given bounding box is invalid the new sub-region will be a default sub-region.

Parameters
boundingBoxBounding box that will defined the sub-region

Member Function Documentation

◆ boundingBox()

const Box2 & Ocean::CV::SubRegion::boundingBox ( ) const
inline

Returns the bounding box of this sub-region.

Returns
Sub-region bounding box

◆ filterPoints()

Vectors2 Ocean::CV::SubRegion::filterPoints ( const Vectors2 points) const

Filters a set of given image points so that all resulting points ly inside this sub-region.

Parameters
pointsThe set of image points which will be filtered
Returns
Image points lying inside this sub-region

◆ isEmpty()

bool Ocean::CV::SubRegion::isEmpty ( ) const
inline

Returns whether this sub-region is empty.

Returns
True, if so

◆ isInside()

bool Ocean::CV::SubRegion::isInside ( const Vector2 point) const

Returns whether a given point lies inside this sub-region.

Parameters
pointPoint to be checked
Returns
True, if so

◆ mask()

const Frame & Ocean::CV::SubRegion::mask ( ) const
inline

Returns the binary sub-region mask, if any.

Returns
Sub-region mask, otherwise an invalid frame is returned

◆ operator bool()

Ocean::CV::SubRegion::operator bool ( ) const
inlineexplicit

Returns whether this sub-region is not empty.

Returns
True, if so

◆ operator*() [1/2]

SubRegion Ocean::CV::SubRegion::operator* ( const Scalar  factor) const

Increases or decreases a sub-region by application of a scalar multiplication factor.

Parameters
factorThe multiplication factor defining the new sub-region, with range [0, infinity)
Returns
Resulting sub-region with new location and size due to the provided factor

◆ operator*() [2/2]

SubRegion Ocean::CV::SubRegion::operator* ( const SquareMatrix3 homography) const

Transforms a sub-region by application of a homography that transforms points in the initial frame to points in the new frame.

Parameters
homographyThe homography transforming points defined in the coordinate system of the initial frame into points defined in the coordinate system of the new frame.
Returns
Resulting transformed subregion

◆ operator=() [1/2]

SubRegion & Ocean::CV::SubRegion::operator= ( const SubRegion subRegion)
inline

Assign operator.

Parameters
subRegionSub-region object to be assigned
Returns
Reference to this object

◆ operator=() [2/2]

SubRegion & Ocean::CV::SubRegion::operator= ( SubRegion &&  subRegion)
inlinenoexcept

Move operator.

Parameters
subRegionSub-region object to be moved
Returns
Reference to this object

◆ size()

Scalar Ocean::CV::SubRegion::size ( ) const

Returns the number of pixels that are covered by this region.

Returns
The number of pixels, with range [0, infinity)

◆ triangles()

const Triangles2 & Ocean::CV::SubRegion::triangles ( ) const
inline

Returns the 2D triangles of this sub-region, if any.

Returns
2D sub-region triangles

Field Documentation

◆ boundingBox_

Box2 Ocean::CV::SubRegion::boundingBox_
private

Bounding box of this sub-region.

◆ mask_

Frame Ocean::CV::SubRegion::mask_
private

A binary frame defining the sub-region per pixel.

◆ maskValue_

uint8_t Ocean::CV::SubRegion::maskValue_ = 0x00u
private

The pixel value defining the sub-region.

◆ triangles_

Triangles2 Ocean::CV::SubRegion::triangles_
private

A set of 2D triangles defining the sub-region.


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