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.
Public Member Functions | |
tlChain () | |
tlChain (tlPoint *start) | |
tlChain (int startx, int starty) | |
virtual | ~tlChain () |
int | getLength () |
int | isClosed () |
int | getConnex () |
tlPoint * | getStart () |
tlPoint * | getEnd () |
tlPoint * | getPoint (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) |
tlChain::tlChain | ( | ) |
tlChain::tlChain | ( | tlPoint * | startPoint | ) |
Constructor, creates a tlChain with one starting point.
startPoint | starting point for chain extraction |
tlChain::tlChain | ( | int | startx, | |
int | starty | |||
) |
Constructor, creates a tlChain with one starting point.
startx | starting point X coord | |
starty | starting point Y coord |
tlChain::~tlChain | ( | ) | [virtual] |
int tlChain::getLength | ( | ) | [inline] |
Get the chain length.
int tlChain::isClosed | ( | ) | [inline] |
Test whether the chain is closed or not.
int tlChain::getConnex | ( | ) | [inline] |
Test whether the chain connectivity.
tlPoint * tlChain::getStart | ( | ) | [inline] |
Retrieve the first point of the chain.
start
point on success, NULL if the chain is empty.tlPoint * tlChain::getEnd | ( | ) | [inline] |
Retrieve the last point of the chain.
end
point on success, NULL if the chain is empty.tlPoint * tlChain::getPoint | ( | int | index | ) |
Get the point at a given index in the chain (if it exists).
index | point index |
int tlChain::reset | ( | ) |
Reset the chain (remove all points), same as clear().
int tlChain::clear | ( | ) |
Reset the chain (remove all points), same as reset().
int tlChain::filter | ( | int | radius | ) |
Remove close neighbors to avoid redundancies.
radius | the minimum allowed distance between 2 points |
int tlChain::close | ( | ) |
Close the chain (requires at least 2 points to be in the chain).
int tlChain::isIn | ( | tlPoint * | point | ) | [inline] |
Test for the presence of a point in the chain.
point | point to test for |
int tlChain::add | ( | int | x, | |
int | y | |||
) |
Insert a point at the end of the chain.
x | the point to add X coord | |
y | the point to add Y coord |
int tlChain::insert | ( | int | index, | |
int | x, | |||
int | y | |||
) |
Insert a point at a specific index in the chain.
index | the index to insert to point at | |
x | the point to add X coord | |
y | the point to add Y coord |
int tlChain::remove | ( | int | index | ) |
Remove a point at a specific index from the chain.
index | the index of the point to remove |
int tlChain::remove | ( | int | x, | |
int | y | |||
) |
Remove a point from the chain if it exists.
x | point to remove X coord | |
y | point to remove Y coord |
Extract a chain from a binary image.
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 |
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.
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) |
x
,y
) until a valid point is found. Extract a chain from a mask.
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 |
Extract a chain from a mask. Looks around a given point for a valid starting point.
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) |
x
,y
) until a valid point is found. int tlChain::corners | ( | tlChain * | corners | ) |
Extract chain corners (points of high curvature) using default parameters.
int tlChain::corners | ( | int | res, | |
int | alphaMax, | |||
tlChain * | corners | |||
) |
Extract chain corners (points of high curvature).
res | triangle segment length [chain elements] | |
alphaMax | max allowed angle (for normal curvature) | |
corners | [out] a chain containing the corner points |
int tlChain::corners | ( | int | dmin, | |
int | dmax, | |||
int | alphaMax, | |||
tlChain * | corners | |||
) |
Extract chain corners (points of high curvature).
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 |