From abdb6275c24e499396c954585cd13ee607107a13 Mon Sep 17 00:00:00 2001
From: evenp <Philippe.Even@loria.fr>
Date: Tue, 17 Nov 2020 11:35:00 +0100
Subject: [PATCH] Crosswise tracking modality withdrawn

---
 Code/FBSD/BSTools/bsdetectionwidget.cpp    | 11 -----------
 Code/FBSD/BlurredSegment/bsdetector.h      | 10 ----------
 Code/FBSD/BlurredSegment/bsproto.h         |  2 +-
 Code/FBSD/BlurredSegment/bstracker.cpp     | 18 +++---------------
 Code/FBSD/BlurredSegment/bstracker.h       | 14 +-------------
 Code/FBSD/ImageTools/digitalstraightline.h |  6 +++---
 Methode/ctrl.tex                           | 13 ++++++-------
 7 files changed, 14 insertions(+), 60 deletions(-)

diff --git a/Code/FBSD/BSTools/bsdetectionwidget.cpp b/Code/FBSD/BSTools/bsdetectionwidget.cpp
index 5bebed9..2a78e44 100755
--- a/Code/FBSD/BSTools/bsdetectionwidget.cpp
+++ b/Code/FBSD/BSTools/bsdetectionwidget.cpp
@@ -784,17 +784,6 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event)
       break;
 
     case Qt::Key_U :
-// DEV IN
-      if (event->modifiers () & Qt::ControlModifier)
-      {
-        // Switches the crosswise segment detection
-        detector.switchTrackCrosswise ();
-        extract ();
-        cout << "Crosswise segment detection "
-             << (detector.trackCrosswiseOn () ? "on" : "off") << endl;
-      }
-      else
-// DEV OUT
       {
         // Replays last extraction
         cerr << "p1 update: " << p1.x () << " " << p1.y () << endl;
diff --git a/Code/FBSD/BlurredSegment/bsdetector.h b/Code/FBSD/BlurredSegment/bsdetector.h
index 03a29da..20a7515 100755
--- a/Code/FBSD/BlurredSegment/bsdetector.h
+++ b/Code/FBSD/BlurredSegment/bsdetector.h
@@ -256,16 +256,6 @@ public:
    */
   inline void switchAutoRestart () { bst2->switchAutoRestart (); }
 
-  /**
-   * \brief Returns whether the crosswise segment detection is set.
-   */
-  inline bool trackCrosswiseOn () const { return bst2->trackCrosswiseOn (); }
-
-  /**
-   * \brief Switches on or off the crosswise segment detection.
-   */
-  inline void switchTrackCrosswise () { bst2->switchTrackCrosswise (); }
-
   /**
    * \brief Returns the preliminary detection modality status.
    */
diff --git a/Code/FBSD/BlurredSegment/bsproto.h b/Code/FBSD/BlurredSegment/bsproto.h
index 6bbddb6..4e00d49 100755
--- a/Code/FBSD/BlurredSegment/bsproto.h
+++ b/Code/FBSD/BlurredSegment/bsproto.h
@@ -40,7 +40,7 @@ public:
   /**
    * \brief Checks if the blurred segment has at least two points.
    */
-  inline bool isLineable () const {
+  inline bool isExtending () const {
     return (bsOK || bsFlat || leftOK || rightOK); }
 
   /**
diff --git a/Code/FBSD/BlurredSegment/bstracker.cpp b/Code/FBSD/BlurredSegment/bstracker.cpp
index 705c4ee..0b4fc82 100755
--- a/Code/FBSD/BlurredSegment/bstracker.cpp
+++ b/Code/FBSD/BlurredSegment/bstracker.cpp
@@ -26,7 +26,6 @@ BSTracker::BSTracker ()
 
   fittingDelay = DEFAULT_FITTING_DELAY;
   recordScans = false;
-  trackCrosswise = false;
 
   assignedThicknessControlDelay = DEFAULT_ASSIGNED_THICKNESS_CONTROL_DELAY;
 
@@ -261,14 +260,14 @@ BlurredSegment *BSTracker::fineTrack (int bsMaxWidth,
     }
 
     // Resets the scan stripe
-    if (count > fittingDelay && bs.isLineable ())
+    if (count > fittingDelay && bs.isExtending ())
     {
       // Stops the detection if the segment gets crosswise
       if (count == fittingDelay + 1)
       {
         Vr2i dirn = bs.getSupportVector ();
         if (4 * dirn.squaredScalarProduct (scandir)
-            < 3 * dirn.norm2 () * scandir.norm2 ())
+            < 3 * dirn.norm2 () * scandir.norm2 ())  // div. angle > 30 degrees
         {
           scanningLeft = false;
           scanningRight = false;
@@ -276,20 +275,9 @@ BlurredSegment *BSTracker::fineTrack (int bsMaxWidth,
         }
       }
       int ppa, ppb, ppc;
-      bs.getLine()->getMedialAxis (ppa, ppb, ppc);
+      bs.getLine()->getCentralLine (ppa, ppb, ppc);
       ds->bindTo (ppa, ppb, ppc);
     }
-    else if (trackCrosswise && count > 3 && bs.isLineable ())
-    {
-      Vr2i dirn = bs.getSupportVector ();
-      if (4 * dirn.squaredScalarProduct (scandir)
-          < 3 * dirn.norm2 () * scandir.norm2 ())
-      {
-        scanningLeft = false;
-        scanningRight = false;
-        fail += FAILURE_LOST_ORIENTATION;
-      }
-    }
 
     // Extends on right
     if (scanningRight)
diff --git a/Code/FBSD/BlurredSegment/bstracker.h b/Code/FBSD/BlurredSegment/bstracker.h
index 0a9f5d3..caab1f6 100755
--- a/Code/FBSD/BlurredSegment/bstracker.h
+++ b/Code/FBSD/BlurredSegment/bstracker.h
@@ -56,7 +56,7 @@ public:
    * Finer detection using gradient ridges and direction input.
    * @param bsMaxWidth Initial assigned maximal width of the blurred segment.
    * @param center Central point of the scan.
-   * @param scandir Scan direction
+   * @param scandir Scan stripe direction.
    * @param scanwidth Width of the scan strip.
    * @param gref Gradient vector reference to select candidates.
    */
@@ -86,16 +86,6 @@ public:
   inline void switchAutoRestart () {
     minRestart = (minRestart == 1 ? acceptedLacks : 1); }
 
-  /**
-   * \brief Returns whether the crosswise segment detection is set.
-   */
-  inline bool trackCrosswiseOn () const { return trackCrosswise; }
-
-  /**
-   * \brief Switches on or off the crosswise segment detection.
-   */
-  inline void switchTrackCrosswise () { trackCrosswise = ! trackCrosswise; }
-
   /**
    * \brief Returns the proximity test status.
    */
@@ -209,8 +199,6 @@ private :
 
   /** Minimal detection width before activating the dynamical scans. */
   int fittingDelay;
-  /** Crosswise segment detection modality. */
-  bool trackCrosswise;
 
   /** Count of stable point insertion before activation of ATC. */
   int assignedThicknessControlDelay;
diff --git a/Code/FBSD/ImageTools/digitalstraightline.h b/Code/FBSD/ImageTools/digitalstraightline.h
index 2275278..1052908 100755
--- a/Code/FBSD/ImageTools/digitalstraightline.h
+++ b/Code/FBSD/ImageTools/digitalstraightline.h
@@ -82,12 +82,12 @@ public:
     a = this->a; b = this->b; c = this->c; nu = this->nu; }
 
   /**
-   * \brief Sets given values with the three medial axis parameters.
+   * \brief Sets given values with the three central naive line parameters.
    * @param a X Slope parameter to provide.
    * @param b Y Slope parameter to provide.
-   * @param c0 Intercept parameter of the median axis.
+   * @param c0 Intercept parameter of the central naive line.
    */
-  inline void getMedialAxis (int &a, int &b, int &c0) const {
+  inline void getCentralLine (int &a, int &b, int &c0) const {
     a = this->a; b = this->b; c0 = c + nu / 2; }
 
   /**
diff --git a/Methode/ctrl.tex b/Methode/ctrl.tex
index 86bcd88..60ed57d 100755
--- a/Methode/ctrl.tex
+++ b/Methode/ctrl.tex
@@ -28,6 +28,7 @@ b && Ajuste le contraste de l'image \\
 c && Commute le jeu de couleurs d'affichage des segments flous \\
 d && Commute le style d'affichage des segments flous \\
 e && Inverse la direction de r\'ef\'erence (autre bord) \\
+f && Ajuste le rapport de longueur appliqu\'e lors du test NFA \\
 g && Ajuste la sensibilit\'e du d\'etecteur (seuil du gradient) \\
 j && Ajuste le seuil de voisinage pour les suivis rapides \\
 k && Ajuste la taille minimale des fragments \\
@@ -47,9 +48,7 @@ z && Ajuste le d\'elai de d\'eclenchement du contr\^ole de la consigne d'\'epais
 Ctrl-b && Commute le fond d'\'ecran de la fen\^etre principale \\
 Ctrl-d && Commute la d\'etection des bords oppos\'es en multi-d\'etection \\
 Ctrl-e && Commute la prise en compte de la direction du bord (trait / contour) \\
-Ctrl-f && Commute le pr\'e-filtrage (segment initial) \\
-Ctrl-g && Commute la directionnalit\'e (ortho) des scans \\
-Ctrl-h && Commute le filtrage du segment final \\
+Ctrl-f && Commute le filtrage NFA \\
 Ctrl-j && Commute la contrainte de voisinage pour les suivis rapides \\
 Ctrl-k && Commute le test de fragmentation \\
 Ctrl-l && Commute le test initial de densit\'e \\
@@ -57,16 +56,12 @@ Ctrl-m && Commute la d\'etection multiple \\
 Ctrl-n && Commute la limitation de l'extension de la d\'etection initiale \\
 Ctrl-o && Commute l'affichage des mesures des segments d\'etect\'es \\
 Ctrl-p && Commute la d\'etection pr\'eliminaire \\
-Ctrl-q && Commute le contr\^ole dynamique des scans \\
 Ctrl-r && Commute la dilatation du masque d'occupation \\
 Ctrl-s && Commute le test final de taille minimale des segments flous \\
 Ctrl-t && Commute la gestion des reprises sur interruption (1 / longueur absence) \\
-Ctrl-u && Commute la d\'etection des segments en travers \\
 Ctrl-v && Commute l'affichage du r\'esultat de la d\'etection en console (verbose) \\
 Ctrl-w && Commute le recentrage du scan sur le segment d\'etect\'e \\
-Ctrl-x && Commute l'ancien (sans ADS et ATC) et le nouveau d\'etecteur \\
 Ctrl-y && Commute le test de densit\'e final \\
-Ctrl-z && Commute le contr\^ole de la consigne d'\'epaisseur \\
 $<>$ && D\'ecale horizontalement l'affichage sur une grosse image \\
 $\wedge\vee$ && D\'ecale verticalement l'affichage sur une grosse image \\
 +- && Zoom (ou d\'ezoome) sur une grosse image \\
@@ -114,6 +109,10 @@ $\wedge \vee$ && Parcours des bandes \\
 $< \wedge > \vee$ && D\'ecalage de l'observation \\
 \hline \hline
 \multicolumn{3}{|l|}{Param\`etres d'ex\'ecution :} \\
+{\tt -p} && Lance FBSD avec la fen\^etre d'analyse des profils. \\
+{\tt -s} && Lance FBSD avec la fen\^etre d'analyse de la d\'etection. \\
+{\tt -i} && Lance FBSD avec la fen\^etre d'analyse de la d\'etection initiale. \\
+{\tt -psi} && Lance FBSD avec les 3 fen\^etres auxiliaires. \\
 {\tt -out} && Sort les lignes d'une d\'etection auto sur l'image fournie
 dans {\tt naivelines.txt}. \\
 {\tt -random} && Lance un test de perfomance sur 1000 images synth\'etiques. \\
-- 
GitLab