AURobotServers
4
|
Extract features with the Split-and-Merge principle. More...
#include <auextractfeatures.h>
Classes | |
struct | segment_s |
Linked list struct. More... | |
Public Member Functions | |
AUExtractFeatures () | |
void | doClusters (double configClusterDiff, double configRangeMin) |
Divide laser scanner data into clusters. More... | |
void | doDiscard (int configDiscardDots, double configDiscardSize) |
void | doFindCircles (int configCircleMinDots, double configCircleMSQ, double configCircleMinR, double configCircleMaxR, double configCircleMinCg, double configCircleMaxCg) |
Tries to make circles out of neighbouring line segments. More... | |
void | doMerge (double configMergeMSQ) |
Merges segments. More... | |
int | doSplits (double configSplitMSQ) |
Splits segments if msq > configSplitMSQ. More... | |
void | extractFeatures (RangeData *data_) |
Extract features from a RangeData dataset. More... | |
void | extractFeatures (RangeData *data_, AUEFReturnStruct *res) |
Initiates the feature extraction from a RangeData object. More... | |
PolarLineFit * | findLongestLine (bool rightwise) |
int | findSplit (PolarLineFit *line) |
Find point to split segment. More... | |
int | getCircleCount () |
Number of circles extracted. More... | |
int | getFeatures (AUEFReturnStruct *res) |
Return features to struct. More... | |
int | getLineCount () |
Number of lines extracted. More... | |
int | getParam (int p, char *value) |
CircleFit * | getSegmentCircle (int idx) |
get corcle fit structure More... | |
int | getSegmentCount () |
Number of segments extracted. More... | |
PolarLineFit * | getSegmentLine (int idx) |
get line segment More... | |
int | paramCount () |
const char * | paramName (int p) |
virtual const char * | print (const char *preString, char *buff, int buffCnt) |
void | segmentToStringCart (int seg, char *reply) |
XML format of segment. More... | |
void | segmentToStringPolar (int seg, char *reply) |
XML format of segment. More... | |
void | setDefaults () |
Set all configurable vars to default. More... | |
void | setParam (int p, const char *value) |
virtual | ~AUExtractFeatures () |
Protected Attributes | |
double | configCircleMaxCg |
Min coverage for circle. More... | |
double | configCircleMaxR |
Max allowed radius for circle. More... | |
double | configCircleMinCg |
Min coverage for circle. More... | |
int | configCircleMinDots |
Min dots for circle. More... | |
double | configCircleMinR |
Min allowed radius for circle. More... | |
double | configCircleMSQ |
Max MSQ for circle. More... | |
double | configClusterDiff |
Range diff. resulting in cluster split. More... | |
int | configDiscardDots |
Discard elements exceeding this MSQ. More... | |
double | configDiscardSize |
Discard segments with length/diameter smaller than this. More... | |
double | configMergeMSQ |
Max mean square error accepted for merges. More... | |
int | configMinSegment |
Minimum number of points in segment. More... | |
char | configMode |
Split and merge configuration. More... | |
double | configRangeMin |
Dots below range min. are disregarded. More... | |
double | configSplitMSQ |
Mean square error resulting in split. More... | |
RangeData * | data |
Laser scanner data. More... | |
struct AUExtractFeatures::segment_s | segment [SEGMENTS_MAX] |
int | segments |
number of segments allocated More... | |
Private Member Functions | |
void | addLineSegment (int first, int last) |
Add line segment to list. More... | |
void | addSegment () |
Add one segment to list. More... | |
void | removeSegment (int index) |
Remove segment from list. More... | |
void | resetSegments () |
Reset all segments. More... | |
Extract features with the Split-and-Merge principle.
AUExtractFeatures::AUExtractFeatures | ( | ) |
Constructor
|
virtual |
Destructor
|
private |
Add line segment to list.
first,last | first and last data point in data range for segment. |
References data, and SEGMENTS_MAX.
|
private |
Add one segment to list.
References FIRST_SEGMENT.
void AUExtractFeatures::doClusters | ( | double | configClusterDiff, |
double | configRangeMin | ||
) |
Divide laser scanner data into clusters.
References data, and OUT_OF_RANGE.
void AUExtractFeatures::doDiscard | ( | int | configDiscardDots, |
double | configDiscardSize | ||
) |
References FIRST_SEGMENT_INDEX.
void AUExtractFeatures::doFindCircles | ( | int | configCircleMinDots, |
double | configCircleMSQ, | ||
double | configCircleMinR, | ||
double | configCircleMaxR, | ||
double | configCircleMinCg, | ||
double | configCircleMaxCg | ||
) |
Tries to make circles out of neighbouring line segments.
References data, FIRST_SEGMENT, CircleFit::fitLines(), CircleFit::getCoverage(), CircleFit::getFirst(), CircleFit::getInverted(), CircleFit::getMSQ(), CircleFit::getRadius(), and LAST_SEGMENT.
void AUExtractFeatures::doMerge | ( | double | configMergeMSQ | ) |
Merges segments.
The merge is completed if a new segment will have less MSQ than the previous segment.
Both lines and circles are handled.
References data, FIRST_SEGMENT, PolarLineFit::fitRange(), PolarLineFit::getFirst(), PolarLineFit::getMSQ(), and LAST_SEGMENT.
int AUExtractFeatures::doSplits | ( | double | configSplitMSQ | ) |
Splits segments if msq > configSplitMSQ.
Not recursive, a segment is maximally split once.
Returns number of splits done
References FIRST_SEGMENT, PolarLineFit::getFirst(), PolarLineFit::getLast(), PolarLineFit::getMSQ(), and LAST_SEGMENT.
void AUExtractFeatures::extractFeatures | ( | RangeData * | data_ | ) |
Extract features from a RangeData dataset.
Initiates the feature extraction from a RangeData object.
*data_ | Pointer to a RangeData object. |
References data, EF_DO_DISCARD, EF_DO_MERGE, EF_DO_SPLIT, EF_NO_LINES, EF_SEE_CIRCLES, and FIRST_SEGMENT_INDEX.
Referenced by UResAuEf::findFeatures(), and simulate().
void AUExtractFeatures::extractFeatures | ( | RangeData * | data_, |
AUEFReturnStruct * | res | ||
) |
PolarLineFit * AUExtractFeatures::findLongestLine | ( | bool | rightwise | ) |
References FIRST_SEGMENT_INDEX, and PolarLineFit::getLength().
int AUExtractFeatures::findSplit | ( | PolarLineFit * | line | ) |
Find point to split segment.
Finds the point (extremum) with maximum distance to the line. The point cannot be an end point.
*line | Pointer to PolarLineFit object |
References data, PolarLineFit::distToLine(), PolarLineFit::getFirst(), and PolarLineFit::getLast().
int AUExtractFeatures::getCircleCount | ( | ) |
int AUExtractFeatures::getFeatures | ( | AUEFReturnStruct * | res | ) |
Return features to struct.
Interal features extracted via calls to the class are returned.
Both lines and circles are handled.
References AUEFReturnStruct::circles, AUEFReturnStruct::clear(), AUCircle::coverage, AUCircle::cr, AUCircle::cth, AULine::end_th, FIRST_SEGMENT_INDEX, AULine::length, AUEFReturnStruct::lines, AUCircle::msq, AULine::msq, AUEFReturnStruct::noCircles, AUEFReturnStruct::noLines, AUCircle::points, AULine::points, AULine::polarValid, AUCircle::polarValid, AUCircle::r, AULine::r0, AULine::slope, AULine::start_th, and AULine::th0.
int AUExtractFeatures::getLineCount | ( | ) |
int AUExtractFeatures::getParam | ( | int | p, |
char * | value | ||
) |
References EF_DO_DISCARD, EF_DO_MERGE, EF_DO_SPLIT, EF_NO_LINES, and EF_SEE_CIRCLES.
CircleFit * AUExtractFeatures::getSegmentCircle | ( | int | idx | ) |
get corcle fit structure
idx | index to requested line segment, where 0 is the first |
int AUExtractFeatures::getSegmentCount | ( | ) |
Number of segments extracted.
References FIRST_SEGMENT_INDEX.
Referenced by UResAuEf::findFeatures(), and simulate().
PolarLineFit * AUExtractFeatures::getSegmentLine | ( | int | idx | ) |
get line segment
idx | index to requested line segment, where 0 is the first |
Referenced by UResAuEf::findFeatures().
int AUExtractFeatures::paramCount | ( | ) |
References EF_PCOUNT.
const char * AUExtractFeatures::paramName | ( | int | p | ) |
References pName.
|
virtual |
print status to a string buffer
Reimplemented in UResAuEf.
|
private |
Remove segment from list.
index | Index in the linked list to be removed |
|
private |
Reset all segments.
References FIRST_SEGMENT, FIRST_SEGMENT_INDEX, and LAST_SEGMENT.
void AUExtractFeatures::segmentToStringCart | ( | int | seg, |
char * | reply | ||
) |
XML format of segment.
seg,*reply | seg: segment index. reply: pointer to string. |
Referenced by simulate().
void AUExtractFeatures::segmentToStringPolar | ( | int | seg, |
char * | reply | ||
) |
XML format of segment.
seg,*reply | seg: segment index. reply: pointer to string. |
void AUExtractFeatures::setDefaults | ( | ) |
Set all configurable vars to default.
References EF_DO_DISCARD, EF_DO_MERGE, EF_DO_SPLIT, and EF_SEE_CIRCLES.
void AUExtractFeatures::setParam | ( | int | p, |
const char * | value | ||
) |
References EF_DO_DISCARD, EF_DO_MERGE, EF_DO_SPLIT, EF_NO_LINES, and EF_SEE_CIRCLES.
|
protected |
Min coverage for circle.
|
protected |
Max allowed radius for circle.
|
protected |
Min coverage for circle.
|
protected |
Min dots for circle.
|
protected |
Min allowed radius for circle.
|
protected |
Max MSQ for circle.
|
protected |
Range diff. resulting in cluster split.
Referenced by UResAuEf::getParams().
|
protected |
Discard elements exceeding this MSQ.
Referenced by UResAuEf::getParams().
|
protected |
Discard segments with length/diameter smaller than this.
Referenced by UResAuEf::getParams().
|
protected |
Max mean square error accepted for merges.
Referenced by UResAuEf::getParams().
|
protected |
Minimum number of points in segment.
Referenced by UResAuEf::getParams().
|
protected |
Split and merge configuration.
Referenced by UResAuEf::getParams().
|
protected |
Dots below range min. are disregarded.
|
protected |
Mean square error resulting in split.
Referenced by UResAuEf::getParams().
|
protected |
Laser scanner data.
|
protected |
|
protected |
number of segments allocated