diff --git a/Code/Seg/BSTools/bsaccumulatoritem.cpp b/Code/Seg/BSTools/bsaccumulatoritem.cpp index 3d834acddedec339d6d2448dfeabef0ed046ec74..73308d0469831762cfbdd868500e28d9ceb8f808 100755 --- a/Code/Seg/BSTools/bsaccumulatoritem.cpp +++ b/Code/Seg/BSTools/bsaccumulatoritem.cpp @@ -17,7 +17,7 @@ BSAccumulatorItem::BSAccumulatorItem (BSDetector *sd, int w, int h) detector = sd; width = w; height = h; - selaccu = 1; + selaccu = 0; map[0] = NULL; map[1] = NULL; solution[0] = -1; diff --git a/Code/Seg/BlurredSegment/blurredsegment.h b/Code/Seg/BlurredSegment/blurredsegment.h index 0395e78a75033268afc98cdbd4024448e2714c7f..ca2ce752b471e4b511382268ec7058823b71340e 100755 --- a/Code/Seg/BlurredSegment/blurredsegment.h +++ b/Code/Seg/BlurredSegment/blurredsegment.h @@ -44,7 +44,7 @@ public: /** * \brief Returns if the segment has non null thickness (not aligned points). */ - inline bool isThick () const { return (dss->width () < 2); } + inline bool isThick () const { return (dss->width () > 1); } /** * \brief Returns the underlying digital straight segment. diff --git a/Code/Seg/BlurredSegment/blurredsegmentproto.cpp b/Code/Seg/BlurredSegment/blurredsegmentproto.cpp index 2354df5d1ed901d2386dbb1a0c0254d12e532968..6e2e1a6624979012e1283b1f19943dbc999a0f29 100755 --- a/Code/Seg/BlurredSegment/blurredsegmentproto.cpp +++ b/Code/Seg/BlurredSegment/blurredsegmentproto.cpp @@ -36,27 +36,15 @@ BlurredSegmentProto::BlurredSegmentProto (int maxWidth, Pt2i center, { if (scanningRight) { - if (itr == rightPts.end ()) - { - scanningRight = false; - rightOK = true; - } - else plist->addBack (*itr++); + if (itr == rightPts.end ()) scanningRight = false; + else + addRight (*itr++); } if (scanningLeft) { if (itl == leftPts.end ()) scanningLeft = false; else - { - plist->addFront (*itl++); - leftOK = true; - } - } - if (! bsOK && plist->size () > 2) - { - if (! plist->backPoint().colinearTo (plist->frontPoint (), - plist->initialPoint ())) - bsOK = true; + addLeft (*itl++); } } } diff --git a/Code/Seg/BlurredSegment/linespacefilter.cpp b/Code/Seg/BlurredSegment/linespacefilter.cpp index 2745c38396846d385cb1c615955e050a0e9450a8..719a8c2154da62bf2b6a2c02e3a14ede50738acc 100755 --- a/Code/Seg/BlurredSegment/linespacefilter.cpp +++ b/Code/Seg/BlurredSegment/linespacefilter.cpp @@ -22,6 +22,7 @@ const int LineSpaceFilter::ANG_MAX_ZOOM = 32; const int LineSpaceFilter::DIST_DEF_ZOOM = 4; const int LineSpaceFilter::DIST_MIN_ZOOM = 1; const int LineSpaceFilter::DIST_MAX_ZOOM = 16; +const int LineSpaceFilter::INPUT_MIN_SIZE = 8; LineSpaceFilter::LineSpaceFilter () @@ -63,7 +64,7 @@ BlurredSegment *LineSpaceFilter::filter (BlurredSegment *bs) bsFinalSize = 0; if (bs == NULL || ! bs->isThick ()) return NULL; bsInitialSize = bs->size (); - if (bsInitialSize < 10) return NULL; + if (bsInitialSize < INPUT_MIN_SIZE) return NULL; // Gets the line spacefilter const Pt2i bsstart = bs->getCenter (); @@ -94,11 +95,16 @@ BlurredSegment *LineSpaceFilter::filter (BlurredSegment *bs) fitMask (); // Filters the previous points - for (vector<Pt2i>::const_iterator it = bsleft->begin (); - it != bsleft->end (); it ++) + if (! (bsleft->empty ())) { - if (voteInMask (*it)) leftIn.push_back (Pt2i (*it)); - else out.push_back (Pt2i (*it)); + vector<Pt2i>::const_iterator mit = bsleft->end (); + do + { + mit --; + if (voteInMask (*mit)) leftIn.push_back (Pt2i (*mit)); + else out.push_back (Pt2i (*mit)); + } + while (mit != bsleft->begin ()); } for (vector<Pt2i>::const_iterator it = bsright->begin (); it != bsright->end (); it ++) diff --git a/Code/Seg/BlurredSegment/linespacefilter.h b/Code/Seg/BlurredSegment/linespacefilter.h index 3c6be37fd1fc7c5dd23a8ead91a7ca19e45a4879..da14661bdfc78f46118312bcb727ebbf8b875cf4 100755 --- a/Code/Seg/BlurredSegment/linespacefilter.h +++ b/Code/Seg/BlurredSegment/linespacefilter.h @@ -187,6 +187,8 @@ private : static const int DIST_MIN_ZOOM; /** Distance zoom factor max value. */ static const int DIST_MAX_ZOOM; + /** Segment minimal size to accept voting. */ + static const int INPUT_MIN_SIZE; /** Accumulator. */ int *acc;