TLIB documentation
 

tlChain Class Reference

List of all members.


Detailed Description

Point list management class.

A tlChain object is an arbitrary, dynamic collection of tlPoints. tlChain objects are useful for storing extracted points, but also for continuous edges extraction and other related operations such as angle detections.

See also:
http://visual.ipan.sztaki.hu/corner/cornerweb.html

Public Member Functions

 tlChain ()
 tlChain (tlPoint *start)
 tlChain (int startx, int starty)
virtual ~tlChain ()
int getLength ()
int isClosed ()
int getConnex ()
tlPointgetStart ()
tlPointgetEnd ()
tlPointgetPoint (int index)
int reset ()
int clear ()
int filter (int radius)
int close ()
int isIn (tlPoint *point)
int add (int x, int y)
int insert (int index, int x, int y)
int remove (int index)
int remove (int x, int y)
int extract (tlImage *image, int x, int y, tlRect *rect, int connex=TL_CONNEX_8)
int blindExtract (tlImage *image, int x, int y, tlRect *rect, int connex=TL_CONNEX_8)
int extract (tlMask *mask, int x, int y, tlRect *rect, int connex=TL_CONNEX_8)
int blindExtract (tlMask *mask, int x, int y, tlRect *rect, int connex=TL_CONNEX_8)
int corners (tlChain *corners)
int corners (int res, int alphaMax, tlChain *corners)
int corners (int dmin, int dmax, int alphaMax, tlChain *corners)

Constructor & Destructor Documentation

tlChain::tlChain (  ) 

Constructor, creates an empty tlChain object.

Note:
See error management for details.

tlChain::tlChain ( tlPoint startPoint  ) 

Constructor, creates a tlChain with one starting point.

Parameters:
startPoint starting point for chain extraction
Note:
See error management for details.

tlChain::tlChain ( int  startx,
int  starty 
)

Constructor, creates a tlChain with one starting point.

Parameters:
startx starting point X coord
starty starting point Y coord
Note:
See error management for details.

tlChain::~tlChain (  )  [virtual]

Destructor.

Note:
See error management for details.


Member Function Documentation

int tlChain::getLength (  )  [inline]

Get the chain length.

Returns:
The chain length on success, -1 otherwise.
See error management for details.

int tlChain::isClosed (  )  [inline]

Test whether the chain is closed or not.

Returns:
1 if the chain is closed,
0 otherwise.

int tlChain::getConnex (  )  [inline]

Test whether the chain connectivity.

Returns:
The chain connectivity (TL_CONNEX_4 or TL_CONNEX_8).

tlPoint * tlChain::getStart (  )  [inline]

Retrieve the first point of the chain.

Returns:
A pointer to the start point on success, NULL if the chain is empty.
See error management for details.

tlPoint * tlChain::getEnd (  )  [inline]

Retrieve the last point of the chain.

Returns:
A pointer to the end point on success, NULL if the chain is empty.
See error management for details.

tlPoint * tlChain::getPoint ( int  index  ) 

Get the point at a given index in the chain (if it exists).

Parameters:
index point index
Returns:
A pointer to a new tlPoint on success, NULL on failure.
See error management for details.

int tlChain::reset (  ) 

Reset the chain (remove all points), same as clear().

Returns:
0 on success, -1 otherwise.
See error management for details.

int tlChain::clear (  ) 

Reset the chain (remove all points), same as reset().

Returns:
0 on success, -1 otherwise.
See error management for details.

int tlChain::filter ( int  radius  ) 

Remove close neighbors to avoid redundancies.

Parameters:
radius the minimum allowed distance between 2 points
Returns:
0 on success, -1 otherwise.
See error management for details.

int tlChain::close (  ) 

Close the chain (requires at least 2 points to be in the chain).

Returns:
0 on success, -1 otherwise.
See error management for details.

int tlChain::isIn ( tlPoint point  )  [inline]

Test for the presence of a point in the chain.

Parameters:
point point to test for
Returns:
The index of the point if it is in the chain, -1 otherwise.
See error management for details.

int tlChain::add ( int  x,
int  y 
)

Insert a point at the end of the chain.

Parameters:
x the point to add X coord
y the point to add Y coord
Returns:
The index of the point if insertion is successfull, -1 otherwise.
See error management for details.

int tlChain::insert ( int  index,
int  x,
int  y 
)

Insert a point at a specific index in the chain.

Parameters:
index the index to insert to point at
x the point to add X coord
y the point to add Y coord
Returns:
0 on success, -1 otherwise.
See error management for details.

int tlChain::remove ( int  index  ) 

Remove a point at a specific index from the chain.

Parameters:
index the index of the point to remove
Returns:
0 on success, -1 otherwise.
See error management for details.

int tlChain::remove ( int  x,
int  y 
)

Remove a point from the chain if it exists.

Parameters:
x point to remove X coord
y point to remove Y coord
Returns:
0 on success, -1 otherwise.
See error management for details.

int tlChain::extract ( tlImage image,
int  x,
int  y,
tlRect rect,
int  connex = TL_CONNEX_8 
)

Extract a chain from a binary image.

Parameters:
image binary image
x X coord to start extraction from
y Y coord to start extraction from
connex connectivity (TL_CONNECT_4 or TL_CONNECT_8)
rect bounding rectangle for extraction
Returns:
the length of the extracted chain if successfull,
0 if the starting point is not valid (0),
-1 otherwise.
See error management for details.

int tlChain::blindExtract ( tlImage image,
int  x,
int  y,
tlRect rect,
int  connex = TL_CONNEX_8 
)

Extract a chain from a binary image. Looks around a given point for a valid starting point.

Parameters:
image binary image
x starting point X coord
y starting point Y coord
rect bounding rectangle to limit extraction area
connex connectivity (TL_CONNECT_4 or TL_CONNECT_8)
Returns:
The length of the extracted chain on success, -1 otherwise.
See error management for details.
Remarks:
The starting point can be anywhere within the rectangle. The search algorithm first searches on a vertical and horizontal line for the presence of a valid starting point. If none, it then spirals around (x,y) until a valid point is found.

int tlChain::extract ( tlMask mask,
int  x,
int  y,
tlRect rect,
int  connex = TL_CONNEX_8 
)

Extract a chain from a mask.

Parameters:
mask mask to extract from
x X coord to start extraction from
y Y coord to start extraction from
connex connectivity (TL_CONNECT_4 or TL_CONNECT_8)
rect bounding rectangle for extraction
Returns:
The length of the extracted chain if successfull,
0 if the starting point is not valid (0),
-1 otherwise.
See error management for details.

int tlChain::blindExtract ( tlMask mask,
int  x,
int  y,
tlRect rect,
int  connex = TL_CONNEX_8 
)

Extract a chain from a mask. Looks around a given point for a valid starting point.

Parameters:
mask mask to extract from
x starting point X coord
y starting point Y coord
rect bounding rectangle to limit extraction area
connex connectivity (TL_CONNECT_4 or TL_CONNECT_8)
Returns:
The length of the extracted chain on success, -1 otherwise.
See error management for details.
Remarks:
The starting point can be anywhere within the rectangle. The search algorithm first searches on a vertical and horizontal line for the presence of a valid starting point. If none, it then spirals around (x,y) until a valid point is found.

int tlChain::corners ( tlChain corners  ) 

Extract chain corners (points of high curvature) using default parameters.

Returns:
The number of corners found on success, -1 otherwise.
See error management for details.

int tlChain::corners ( int  res,
int  alphaMax,
tlChain corners 
)

Extract chain corners (points of high curvature).

Parameters:
res triangle segment length [chain elements]
alphaMax max allowed angle (for normal curvature)
corners [out] a chain containing the corner points
Returns:
The number of corners found on success, -1 otherwise.
See error management for details.

int tlChain::corners ( int  dmin,
int  dmax,
int  alphaMax,
tlChain corners 
)

Extract chain corners (points of high curvature).

Parameters:
dmin min triangle segment length [chain elements]
dmax max triangle segment length [chain elements]
alphaMax max allowed angle (for normal curvature)
corners [out] a chain containing the corner points
Returns:
The number of corners found on success, -1 otherwise.
See error management for details.


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

TLIB documentation - generated on 7 May 2008
Please address any questions to seb@tuyphon.com
(C) 2001-2008 - S. Grange
(C) 2001-2007 - VRAI Group, EPFL
All Rights Reserved.