last update 20 Sep 2009 |
#include <cvrAreaPoints.h>
Public Member Functions | |
areaPoints () | |
areaPoints (const areaPoints &other) | |
virtual | ~areaPoints () |
areaPoints & | castFrom (const borderPoints &theBorderPoints) |
areaPoints & | castFrom (const ioPoints &theIoPoints) |
areaPoints & | copy (const areaPoints &other) |
areaPoints & | operator= (const areaPoints &other) |
virtual const std::string & | name () const |
virtual areaPoints * | clone () const |
virtual areaPoints * | newInstance () const |
bool | extractFromMask (const matrix< ubyte > &mask) |
bool | generateMask (matrix< ubyte > &mask, const bool computeBoundary=true, const bool exactBoundaryDimensions=false, const bool keepMaskData=false) const |
int | intersectionArea (const irectangle &rect) const |
areaPoints is a ipointList that contains all points that belong to a specified area.
For the explanation of the contour description in this class, see following image:
-- 00000000001111111111222222222233 -- 01234567890123456789012345678901 00 -------------------------------- 01 -------------------------------- 02 -------------------------------- 03 --------BBBB------BBBB---------- 04 -------B****BBB----B**B--------- 05 -------B*******B---B***B-------- 06 ------B*******B-----B*B--------- 07 -------B*******BBBBB**B--------- 08 ---------B*************B-------- 09 --------B**----*********B------- 10 --------B**-----********B------- 11 -------B**-----*******BB-------- 12 ------B**-----*******B---------- 13 ------B**-------******BB-------- 14 -----B**---------*******B------- 15 -----B**--------*********B------ 16 ----B**-------**********BB------ 17 ---B***----*******----BB-------- 18 ----BBBBBBBBB*** --*B---------- 19 -------------BBBBBBBB----------- 20 -------------------------------- 21 -------------------------------- 22 -------------------------------- 23 -------------------------------- "-" means background and the rest is part of the object. "B" indicates a borderpoint.
This contour class allows three representations of a contour:
cvr::areaPoints::areaPoints | ( | ) |
Default constructor.
empty areaPoints
cvr::areaPoints::areaPoints | ( | const areaPoints & | other | ) |
Copy constructor.
virtual cvr::areaPoints::~areaPoints | ( | ) | [virtual] |
Destructor.
areaPoints& cvr::areaPoints::castFrom | ( | const ioPoints & | theIoPoints | ) |
Extracts areaPoints from ioPoints.
areaPoints& cvr::areaPoints::castFrom | ( | const borderPoints & | theBorderPoints | ) |
Extracts areaPoints from borderPoints.
virtual areaPoints* cvr::areaPoints::clone | ( | ) | const [virtual] |
Create a clone of the areaPoints.
Reimplemented from cvr::pointList< T >.
areaPoints& cvr::areaPoints::copy | ( | const areaPoints & | other | ) |
Extracts areaPoints from the given polygonPoints.
Copy other
areaPoints into these.
Extracts areaPoints from the given mask.
This function assumes that the mask contains JUST ONE connected object. To get the biggest object on the mask see cvr::objectsFromMask or cvr::fastRelabeling.
bool cvr::areaPoints::generateMask | ( | matrix< ubyte > & | mask, | |
const bool | computeBoundary = true , |
|||
const bool | exactBoundaryDimensions = false , |
|||
const bool | keepMaskData = false | |||
) | const |
Generate mask from the areaPoints.
The dimensions of the resulting mask are the smallest rectangle to contain the point (0,0) (optional) and all points in this list, plus 1 pixel in both width and heigth. If the given mask is bigger than this size, its dimensions will be kept.
If the boundary of the point list is not up to date, it can be calculated if specified by the arguments:
mask | The calculated mask will be stored here | |
computeBoundary | If false, the internal boundary of the point list will be used, otherwise the boundary will be calculated (but NOT updated!!!). | |
exactBoundaryDimensions | If true, the dimensions of the resulting mask will be the smallest rectangle to contain only the points in this list. The origin (0,0) may not be included, therefore a 1:1 correspondence of coordinates will generally not be given. | |
keepMaskData | if false, the mask will be initialized with zero before getting the area mask. If true, the previous mask data is not deleted, but the mask will be resized if necessary. |
int cvr::areaPoints::intersectionArea | ( | const irectangle & | rect | ) | const |
Compute intersection area with a rectangle.
virtual const std::string& cvr::areaPoints::name | ( | ) | const [virtual] |
virtual areaPoints* cvr::areaPoints::newInstance | ( | ) | const [virtual] |
Create a new instance of areaPoints.
Reimplemented from cvr::pointList< T >.
areaPoints& cvr::areaPoints::operator= | ( | const areaPoints & | other | ) | [inline] |