diff --git a/Code/Seg/BSTools/bsdetectionwidget.cpp b/Code/Seg/BSTools/bsdetectionwidget.cpp index 772688f0ff61203603a44dd4334522bee131c7e7..2ee6df3ec875fca301d53c6f0b7a97fd3dc6aac8 100755 --- a/Code/Seg/BSTools/bsdetectionwidget.cpp +++ b/Code/Seg/BSTools/bsdetectionwidget.cpp @@ -289,11 +289,22 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event) << (detector.isSetDensityTest () ? "on" : "off") << endl; break; - case Qt::Key_W : // Input max width - detector.setInputMaxWidth (detector.getInputMaxWidth () + - (event->modifiers () & Qt::ShiftModifier ? -1 : 1)); - extract (); - cout << "Input max width = " << detector.getInputMaxWidth () << endl; + case Qt::Key_W : // Fast tracks max width + if (event->modifiers () & Qt::ControlModifier) + { + detector.switchAutoWidth (); + cout << "Final step max width " << (detector.autoWidthOn () ? + "fitted to initial segment" : "left unchanged") << endl; + extract (); + } + else + { + detector.setFineTracksMaxWidth (detector.fineTracksMaxWidth () + + (event->modifiers () & Qt::ShiftModifier ? -1 : 1)); + extract (); + cout << "Fine tracks max width = " + << detector.fineTracksMaxWidth () << endl; + } break; case Qt::Key_K : // Output blurred segment min size @@ -333,10 +344,11 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event) break; case Qt::Key_X : - detector.switchAutoWidth (); - cout << "Final step max width " << (detector.autoWidthOn () ? - "fitted to initial segment" : "left unchanged") << endl; + detector.setFastTracksMaxWidth (detector.fastTracksMaxWidth () + + (event->modifiers () & Qt::ShiftModifier ? -1 : 1)); extract (); + cout << "Fast tracks max width = " + << detector.fastTracksMaxWidth () << endl; break; case Qt::Key_S : diff --git a/Code/Seg/BSTools/bsstructureitem.cpp b/Code/Seg/BSTools/bsstructureitem.cpp index 8677a387808565b482610cc21441d4ae72f23ba3..68b3064e8b0afa65e979794d08328d35d280ce39 100755 --- a/Code/Seg/BSTools/bsstructureitem.cpp +++ b/Code/Seg/BSTools/bsstructureitem.cpp @@ -134,8 +134,8 @@ void BSStructureItem::paintBlurredSegment (QPainter *painter, int step) + QString::number (dss->period ()) + QString (" = ") + QString::number (dss->width () / (double) dss->period ())); else addText (painter, QString ("Segment width = 0")); - addText (painter, QString ("W : input max width = ") - + QString::number (det->getInputMaxWidth ())); + addText (painter, QString ("W : fine tracks max width = ") + + QString::number (det->fineTracksMaxWidth ())); addText (painter, QString ("L : output BS min size = ") + QString::number (det->getBSminSize ())); addText (painter, QString ("H : pixel lack tolerence = ") diff --git a/Code/Seg/BSTools/bsstructureview.cpp b/Code/Seg/BSTools/bsstructureview.cpp index 6c5396cdb25b1c986bfb9e2d70c9925478778029..983eea123aa0c3e12b3cd3d7b2d7e24a8b5f6f6a 100755 --- a/Code/Seg/BSTools/bsstructureview.cpp +++ b/Code/Seg/BSTools/bsstructureview.cpp @@ -218,8 +218,8 @@ bool BSStructureView::processKeyEvent (QKeyEvent *event) processed = true; break; - case Qt::Key_W : // Input max width - det->setInputMaxWidth (det->getInputMaxWidth () + + case Qt::Key_W : // Fine tracks max width + det->setFineTracksMaxWidth (det->fineTracksMaxWidth () + (event->modifiers () & Qt::ShiftModifier ? -1 : 1)); update (); processed = true; diff --git a/Code/Seg/BlurredSegment/bsdetector.cpp b/Code/Seg/BlurredSegment/bsdetector.cpp index d628c357736f4e06edd4c8f623c9c675c754bd57..c047401c81b122a6597bc7f5274d2dd506c0697f 100755 --- a/Code/Seg/BlurredSegment/bsdetector.cpp +++ b/Code/Seg/BlurredSegment/bsdetector.cpp @@ -38,7 +38,6 @@ BSDetector::BSDetector () edgeDirection = 0; // detects line (not only edges) bsMinSize = DEFAULT_BS_MIN_SIZE; connectMinSize = DEFAULT_CONNECT_MIN_SIZE; - minScanLength = bst1->defaultMinScan (); autowidth = true; ccOn = true; densityTestOn = true; @@ -240,17 +239,20 @@ void BSDetector::detect (const Pt2i &p1, const Pt2i &p2, Pt2i *p0) Pt2i pCenter = bsini->getCenter (); Vr2i gRef = gMap->getValue (pCenter.x (), pCenter.y ()); if (edgeDirection == -1) gRef.invert (); - int bswidth = bst1->inputMaxWidth (); + int bswidth = bst1->fastTracksMaxWidth (); int scanwidth2 = 4 * bswidth; if (autowidth) { - bswidth = minScanLength; + bswidth = bst1->fineTracksMaxWidth (); +/* DigitalStraightSegment *dss = bsini->getSegment (); if (dss != NULL) { bswidth = (dss->width () / dss->period ()); - if (bswidth < minScanLength) bswidth = minScanLength; + if (bswidth < bst1->fineTracksMaxWidth ()) + bswidth = bst1->fineTracksMaxWidth (); } +*/ scanwidth2 = bswidth; pCenter = bsini->getSegment()->centerOfIntersection (pt1, pt2); } diff --git a/Code/Seg/BlurredSegment/bsdetector.h b/Code/Seg/BlurredSegment/bsdetector.h index a0cabb6dfa1e1c2c4c6463c511a34be897e7e153..f7897f42b7dd55b9afccee23b2c7a32c8968a009 100755 --- a/Code/Seg/BlurredSegment/bsdetector.h +++ b/Code/Seg/BlurredSegment/bsdetector.h @@ -116,15 +116,28 @@ public: inline void preserveFormerBlurredSegments () { mbsf.clear (); } /** - * \brief Returns the input maximal width of the initial segment. + * \brief Returns the assigned maximal width for the fast tracks. */ - inline int getInputMaxWidth () const { return bst1->inputMaxWidth (); } + inline int fastTracksMaxWidth () const { + return bst1->fastTracksMaxWidth (); } /** - * \brief Sets the maximal width of the initial segment. + * \brief Sets the assigned width for the fast tracks. */ - inline void setInputMaxWidth (int value) { - bst1->setInputMaxWidth (value); } + inline void setFastTracksMaxWidth (int value) { + bst1->setFastTracksMaxWidth (value); } + + /** + * \brief Returns the assigned maximal width for the fine tracks. + */ + inline int fineTracksMaxWidth () const { + return bst1->fineTracksMaxWidth (); } + + /** + * \brief Sets the assigned maximal width for the fine tracks. + */ + inline void setFineTracksMaxWidth (int value) { + bst1->setFineTracksMaxWidth (value); } /** * \brief Returns the output blurred segment minimal size. @@ -414,8 +427,6 @@ private : * 0 : no direction condition (detects lines as well as edges) */ int edgeDirection; - /** Minimal length of scan lines. */ - int minScanLength; /** Connectivity constraint status. */ bool ccOn; /** Minimal size of the detected blurred segment. */ diff --git a/Code/Seg/BlurredSegment/bstracker.cpp b/Code/Seg/BlurredSegment/bstracker.cpp index e1c5991b4d2b9322a3541680d202c21b070e4a18..72831a538a5fcb82e131013c1ed8d38d999aed29 100755 --- a/Code/Seg/BlurredSegment/bstracker.cpp +++ b/Code/Seg/BlurredSegment/bstracker.cpp @@ -3,7 +3,8 @@ -const int BSTracker::DEFAULT_MAX_WIDTH = 5; +const int BSTracker::DEFAULT_FAST_TRACK_MAX_WIDTH = 5; +const int BSTracker::DEFAULT_FINE_TRACK_MAX_WIDTH = 8; const int BSTracker::DEFAULT_ACCEPTED_LACKS = 5; const int BSTracker::DEFAULT_PROXIMITY_THRESHOLD = 4; const int BSTracker::MIN_SCAN = 8; @@ -25,7 +26,8 @@ const int BSTracker::FAILURE_LOST_ORIENTATION = 32; BSTracker::BSTracker () { proxThreshold = DEFAULT_PROXIMITY_THRESHOLD; - maxWidth = DEFAULT_MAX_WIDTH; + imaxWidth = DEFAULT_FAST_TRACK_MAX_WIDTH; + fmaxWidth = DEFAULT_FINE_TRACK_MAX_WIDTH; acceptedLacks = DEFAULT_ACCEPTED_LACKS; minRestart = acceptedLacks; @@ -78,7 +80,7 @@ BlurredSegment *BSTracker::fastTrack (const Pt2i &p1, const Pt2i &p2, // Creates the scanner DirectionalScanner *ds = NULL; if (p0 != NULL) - ds = scanp.getScanner (*p0, p1.vectorTo (p2), 4 * maxWidth, false, + ds = scanp.getScanner (*p0, p1.vectorTo (p2), 4 * imaxWidth, false, 0, 0, gMap->getWidth (), gMap->getHeight ()); else ds = scanp.getScanner (p1, p2, 0, 0, gMap->getWidth (), gMap->getHeight ()); @@ -112,7 +114,7 @@ BlurredSegment *BSTracker::fastTrack (const Pt2i &p1, const Pt2i &p2, pfirst.set (pix.at (candide)); } - BlurredSegmentProto bs (maxWidth, pfirst); + BlurredSegmentProto bs (imaxWidth, pfirst); Pt2i lastLeft (pfirst); Pt2i lastRight (pfirst); diff --git a/Code/Seg/BlurredSegment/bstracker.h b/Code/Seg/BlurredSegment/bstracker.h index 9d1aeded1ab8688b276bcd1b8c169c3442432231..1816d8bc7b905cff33381c8e9b0c9292392d7566 100755 --- a/Code/Seg/BlurredSegment/bstracker.h +++ b/Code/Seg/BlurredSegment/bstracker.h @@ -57,20 +57,26 @@ public: const Vr2i &gref); /** - * \brief Returns the input maximal width of the blurred segment. + * \brief Returns the assigned maximal width for fast tracks. */ - inline int inputMaxWidth () const { return maxWidth; } + inline int fastTracksMaxWidth () const { return imaxWidth; } /** - * \brief Sets the input maximal width of the blurred segment. + * \brief Sets the assigned maximal width for fast tracks. */ - inline void setInputMaxWidth (int value) { - if (value > 0) maxWidth = value; } + inline void setFastTracksMaxWidth (int value) { + if (value > 0) imaxWidth = value; } /** - * \brief Returns the default minimal length of scan lines. + * \brief Returns the assigned maximal width for fine tracks. */ - inline int defaultMinScan () const { return MIN_SCAN; } + inline int fineTracksMaxWidth () const { return fmaxWidth; } + + /** + * \brief Sets the assigned maximal width for fine tracks. + */ + inline void setFineTracksMaxWidth (int value) { + if (value > 0) fmaxWidth = value; } /** * \brief Returns the pixel lack tolerence for exdending the blurred segment.. @@ -187,9 +193,11 @@ public: private : // Segment detection default parameters. - /** Default value for the initial max segment width. */ - static const int DEFAULT_MAX_WIDTH; - /** Default value forr the accepted number of successive lacks. */ + /** Default value for the max segment width for fast tracks. */ + static const int DEFAULT_FAST_TRACK_MAX_WIDTH; + /** Default value for the max segment width for fine tracks. */ + static const int DEFAULT_FINE_TRACK_MAX_WIDTH; + /** Default value for the accepted number of successive lacks. */ static const int DEFAULT_ACCEPTED_LACKS; /** Default value for the proximity threshold used for fast tracking. */ static const int DEFAULT_PROXIMITY_THRESHOLD; @@ -224,8 +232,10 @@ private : static const int FAILURE_LOST_ORIENTATION; - /** Blurred segment max half-width. */ - int maxWidth; + /** Blurred segment max width for fast tracks. */ + int imaxWidth; + /** Blurred segment max width for fine tracks. */ + int fmaxWidth; /** Number of awaited points after each failure. */ int minRestart; /** Accepted number of successive lacks (wrt restart points). */ diff --git a/Methode/ctrl.tex b/Methode/ctrl.tex index caf40949a0793d2fc92dafb605e88c469a7b3160..49939101ca509d108ce99d1604465dea408d3632 100755 --- a/Methode/ctrl.tex +++ b/Methode/ctrl.tex @@ -27,7 +27,8 @@ u & \spa & Actualiser \\ v && Afficher le r\'esultat \\ a && Commute l'affichage des points des segments flous. \\ A && Commute l'affichage des bords des segments flous. \\ -w && Consigne initiale d'\'epaisseur du segment flou \\ +w && Consigne d'\'epaisseur du segment flou pour le suivi fin \\ +x && Consigne d'\'epaisseur du segment flou pour le suivi rapide \\ h && Longueur tol\'er\'ee pour les sauts de d\'etection \\ k && Taille minimale des segments d\'etect\'es \\ n && R\'esolution de la grille de d\'etection automatique \\ @@ -48,7 +49,7 @@ f && Commute le filtrage final \\ g && Commute la contrainte de connectivit\'e \\ s && Commute l'aspect dynamique des scans \\ o && Commute l'aspect directionel des scans \\ -x && Commute l'ajustement de la consigne d'\'epaisseur \\ +Ctrl-w && Commute l'ajustement de la consigne d'\'epaisseur \\ P && Capture la fen\^etre principale \\ 1 && Commute la visu des segments (pixels) \\ 2 && Commute la visu de l'accumulateur \\