CVR-Lib last update 20 Sep 2009

cvr::borderPoints Class Reference
[Aggregate Data TypesShape Analysis]

Direct border point representation of a contour. More...

#include <cvrBorderPoints.h>

Inheritance diagram for cvr::borderPoints:

Inheritance graph
[legend]
Collaboration diagram for cvr::borderPoints:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 borderPoints ()
 borderPoints (const borderPoints &other)
virtual ~borderPoints ()
borderPointscastFrom (const ioPoints &theIoPoints)
borderPointscastFrom (const areaPoints &theAreaPoints)
borderPointscastFrom (const ipolygonPoints &polyPoints)
borderPointscopy (const borderPoints &other)
borderPointsoperator= (const borderPoints &other)
virtual const std::string & name () const
virtual borderPointsclone () const
virtual borderPointsnewInstance () 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
void invert ()
bool isConsistent () const

Protected Member Functions

bool inside (const ipoint &p, const matrix< ubyte > &mask)


Detailed Description

Direct border point representation of a contour.

borderPoints is a ipointList that contains all points that belong to a specified border.

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:

See also:
cvr::ioPoints, cvr::areaPoints

Constructor & Destructor Documentation

cvr::borderPoints::borderPoints (  ) 

Default constructor.

empty borderPoints

cvr::borderPoints::borderPoints ( const borderPoints other  ) 

Copy constructor.

virtual cvr::borderPoints::~borderPoints (  )  [virtual]

Destructor.


Member Function Documentation

borderPoints& cvr::borderPoints::castFrom ( const ipolygonPoints polyPoints  ) 

Extracts borderPoints from the given polygonPoints.

borderPoints& cvr::borderPoints::castFrom ( const areaPoints theAreaPoints  ) 

Extracts borderPoints from areaPoints.

borderPoints& cvr::borderPoints::castFrom ( const ioPoints theIoPoints  ) 

Extracts borderPoints from ioPoints.

virtual borderPoints* cvr::borderPoints::clone (  )  const [virtual]

Create a clone of the borderPoints.

Returns:
a pointer to a copy of the borderPoints.

Reimplemented from cvr::pointList< T >.

borderPoints& cvr::borderPoints::copy ( const borderPoints other  ) 

Copy other borderPoints into these.

bool cvr::borderPoints::extractFromMask ( const matrix< ubyte > &  mask  ) 

Extract borderPoints from the given mask image.

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::borderPoints::generateMask ( matrix< ubyte > &  mask,
const bool  computeBoundary = true,
const bool  exactBoundaryDimensions = false,
const bool  keepMaskData = false 
) const

Generate mask from the borderPoints.

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:

Parameters:
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.
Returns:
true if successful, false otherwise.

bool cvr::borderPoints::inside ( const ipoint p,
const matrix< ubyte > &  mask 
) [inline, protected]

Check if the given coordinates point lies inside the mask.

void cvr::borderPoints::invert (  ) 

Invert the direction of the border points.

bool cvr::borderPoints::isConsistent (  )  const

Check consistency of border points.

Border points are consistent if the D8 distance between any two subsequent points (with the first point being subsequent to the last) is exactly 1, i.e. if every border point is "next to" its predecessor, with "next to" meaning "one of the 8 neighbouring pixels in the grid".

virtual const std::string& cvr::borderPoints::name (  )  const [virtual]

Returns the name of this type.

Reimplemented from cvr::pointList< T >.

virtual borderPoints* cvr::borderPoints::newInstance (  )  const [virtual]

Create a clone of the borderPoints.

Returns:
a pointer to a copy of the borderPoints

Reimplemented from cvr::pointList< T >.

borderPoints& cvr::borderPoints::operator= ( const borderPoints other  )  [inline]

Assigment operator (alias for copy(other)).

Parameters:
other the pointList to be copied
Returns:
a reference to the actual pointList


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

Generated on Sun Sep 20 22:08:43 2009 for CVR-Lib by Doxygen 1.5.8