From 3635757ab978cffdcc16f5c6c5a27681c3f706e4 Mon Sep 17 00:00:00 2001
From: even <philippe.even@loria.fr>
Date: Mon, 17 Dec 2018 17:02:24 +0100
Subject: [PATCH] Article: reorganization

---
 Article/Fig_method/algoMulti.tex |  13 ++-
 Article/main.tex                 |   2 +-
 Article/method.tex               | 137 ++++++++++++++++++++++++++---
 Article/notions.tex              | 145 ++++---------------------------
 4 files changed, 148 insertions(+), 149 deletions(-)

diff --git a/Article/Fig_method/algoMulti.tex b/Article/Fig_method/algoMulti.tex
index a005475..139655e 100644
--- a/Article/Fig_method/algoMulti.tex
+++ b/Article/Fig_method/algoMulti.tex
@@ -11,9 +11,9 @@
   \SetKwData{ptb}{$B$}
   \SetKwData{Result}{Result}
 
-  \SetKwArray{occmask}{OccupancyMask}
+  \SetKwArray{mask}{$\mathcal{M}$}
   \SetKwArray{bseg}{BlurredSegment}
-  \SetKwArray{bslist}{ListOfBlurredSegments}
+  \SetKwArray{bslist}{ListOfBS}
   
   \SetKwFunction{locmax}{ComputeAndSortGradientLocalMax}
   \SetKwFunction{sortgradmax}{SortByGradientMagnitude}
@@ -24,20 +24,19 @@
   \SetKwData{End}{End}
   
   \Input{Stroke points \pta, \ptb}
+  \Input{Occupancy mask \mask}
   \Output{\textit{\bslist} $\rightarrow$ list of detected blurred segments}
   \BlankLine
   \bslist $\leftarrow$ \nullset\;
-  \occmask $\leftarrow$ \nullset\;
   \lm $\leftarrow$ \locmax (\pta, \ptb)\;
   \BlankLine
   \For{$i \leftarrow 0$ \KwTo \taille(\lm)}{
-    \bseg $\leftarrow$ detect (\lm[i], \ortho, \eps, \occmask)\;
+    \bseg $\leftarrow$ detect (\lm[i], \ortho, \eps, \mask)\;
     \For{$j \leftarrow 0$ \KwTo \cardinal (\bseg)}{
-      \occmask $\leftarrow$ \bseg[j]\;
+      \mask $\leftarrow$ \bseg[j]\;
   }
     \bslist $\leftarrow$ \bseg\;
   }
   
-  \caption{MultiDetection:
-           finds all blurred segments under an input stroke.}
+  \caption{MultiDetect: finds all blurred segments from input selection.}
 \end{algorithm}
diff --git a/Article/main.tex b/Article/main.tex
index 8981659..a0e5cf9 100755
--- a/Article/main.tex
+++ b/Article/main.tex
@@ -35,7 +35,7 @@
 
     \begin{abstract}
         \input{abstract}  
-    \keywords{Line detection \and discrete geometry \and ONE MORE PLEASE.}
+    \keywords{Line detection \and discrete objects \and image analysis}
     \end{abstract}
 
   \end{frontmatter}
diff --git a/Article/method.tex b/Article/method.tex
index f657dc1..d576676 100755
--- a/Article/method.tex
+++ b/Article/method.tex
@@ -43,8 +43,8 @@ The initial detection consists in building and extending a blurred segment
 $\mathcal{B}_1$ based on the highest gradient points found in each scan
 of a static directional scanner based on an input segment $AB$.
 
-Validity tests based on the length or sparsity of $\mathcal{B}_1$ are
-applied to decide of the detection poursuit. In case of positive response,
+Validity tests aiming at rejecting too short or too sparse blurred segments
+are applied to decide of the detection poursuit. In case of positive response,
 the position $C$ and direction $\vec{D}$ of this initial blurred segment
 are extracted.
 
@@ -60,6 +60,124 @@ appropriate direction.
 The fine track output segment is finally filtered to remove artifacts
 and outliers, and a solution blurred segment $\mathcal{B}_3$ is provided.
 
+\subsection{Adaptive directional scan}
+
+The blurred segment is searched within a directional scan with a position
+and an orientation approximately provided by the user, or blindly defined
+in unsupervised mode.
+Most of the time, the detection stops where the segment escapes sideways
+from the scan strip (\RefFig{fig:escape}).
+A second search is then run using another directional scan aligned
+on the detected segment.
+However, even in case of a correct detection, the estimated orientation
+of the segment is subject to the numerization rounding,
+and the longer the real segment to detect, the higher the probability to
+fail again on a blurred segment escape from the directional scan.
+
+\begin{figure}[h]
+\center
+  \begin{tabular}{c}
+    \includegraphics[width=0.49\textwidth]{Fig_notions/escapeFirst_zoom.png}
+  \end{tabular}
+  \caption{Example of early detection failures
+           on side escapes from the directional scan.}
+  \label{fig:escape}
+\end{figure}
+
+%Even in ideal situation where the detected segment is a perfect line,
+%its width is never null as a result of the discretization process.
+%The estimated direction accuracy is mostly constrained by the length of
+%the detected segment.
+%To avoid these side escapes, the scan should not be a linear strip but
+%rather a conic shape to take into account the blurred segment preimage.
+%This side shift is amplified in situations where the blurred segment is
+%left free to get thicker in order to capture possible noisy features.
+%The assigned width is then still greater than the detected minimal width,
+%so that the segment can move within the directional scan.
+%Knowing the detected blurred segment shape and the image size, it is
+%possible to define a conic scan area, but this solution is computationaly
+%expensive because it leads to useless exploration of large image areas.
+%
+%\begin{figure}[h]
+%\center
+%  %\begin{picture}(300,40)
+%  %\end{picture}
+%  \input{Fig_notions/bscone}
+%  \caption{Possible extension area based
+%           on the detected blurred segment preimage.}
+%  \label{fig:cone}
+%\end{figure}
+
+To overcome this issue, in the former work, an additional refinement step is
+run using the better orientation estimated from the longer segment obtained.
+It is enough to completely detect most of the tested edges, but certainly
+not all, especially if larger images with much longer edges are processed.
+%The solution implemented in the former work was to let some arbitrary
+%margin between the scan strip width and the assigned width to the detection,
+%and to perform two fine detection steps, using for each of them the direction
+%found at the former step.
+As a solution, this operation could be itered as long as the blurred segment
+escapes from the directional scanner using as any fine detection steps as
+necessary.
+But at each iteration, already tested points are processed again,
+thus producing a useless computational cost.
+
+Here the proposed solution is to dynamically align the scan direction to
+the blurred segment one all along the expansion stage.
+At each iteration $i$, the scan strip is updated using the direction
+of the blurred segment computed at previous iteration $i-1$.
+The adaptive directional scan $ADS$ is then defined by :
+\begin{equation}
+%S_i = \mathcal{D}_{i-1} \cap \mathcal{N}_i
+ADS = \left\{
+S_i = \mathcal{D}_i \cap \mathcal{N}_i \cap \mathcal{I}
+\left| \begin{array}{l}
+\delta(\mathcal{N}_i) = - \delta^{-1}(\mathcal{D}_0) \\
+\wedge~ h_0(\mathcal{N}_i) = h_0(\mathcal{N}_{i-1}) + p(\mathcal{D}) \\
+\wedge~ \mathcal{D}_{i} = D (\mathcal{B}_{i-1},\varepsilon + k), i < 1
+\end{array} \right. \right\}
+\end{equation}
+where $D (\mathcal{B}_i,w)$ is the scan strip aligned to the
+detected segment at iteration $i$ with width $w$.
+In practice, the scan width is set a little greater than the assigned
+width $\varepsilon$ ($k$ is a constant arbitrarily set to 4).
+The last clause expresses the update of the scan bounds at iteration $i$.
+Compared to static directional scans, the scan strip moves while
+scan lines remain fixed.
+An example of adaptive directional scan is given in \RefFig{fig:adaption}.
+
+\begin{figure}[h]
+\center
+  \begin{tabular}{c@{\hspace{0.2cm}}c}
+    \includegraphics[width=0.49\textwidth]{Fig_notions/adaptionBounds_zoom.png}
+    & \includegraphics[width=0.49\textwidth]{Fig_notions/adaptionLines_zoom.png}
+  \end{tabular}
+  \caption{Example of blurred segment detection
+           using an adaptive directional scan.
+           On the right picture, the scan bounds are displayed in red, the
+           detected blurred segment in blue, and its bounding lines in green.
+           The left picture displays the successive scans.
+           Adaption is quite sensible when crossing the tile joins.}
+  \label{fig:adaption}
+\end{figure}
+
+\subsection{Control of the assigned width}
+
+The assigned width $\varepsilon$ to the blurred segment recognition algorithm
+is initially set to a large value $\varepsilon_0$ in order to allow the
+detection of large blurred segments.
+Then, when no more augmentation of the minimal width is observed after
+$\lambda$ iterations ($\mu_{i+\lambda} = \mu_i$), it is set to a much
+stricter value able to circumscribe the possible interpretations of the
+segment, that take into account the digitization margins:
+\begin{equation}
+\varepsilon = \mu_{i+\lambda} + 1/2
+\end{equation}
+This strategy aims at preventing the incorporation of spurious outliers in
+further parts of the segment.
+Setting the observation distance to a constant value $\lambda = 20$ seems
+appropriate in most experimented situations.
+
 \subsection{Supervised blurred segment detection}
 
 In supervised context, the user draws an input stroke across the specific
@@ -112,11 +230,11 @@ the awaited one.
     \parbox{0.22\textwidth}{\centering{\scriptsize{c)}}} &
     \parbox{0.22\textwidth}{\centering{\scriptsize{d)}}}
   \end{tabular}
-  \caption{Example of edge disclosed by the multi-detection mode:
-    a) the input selection on the intensity image,
-    b) the gradient map,
-    c) the only sharper edge detected in classical single mode,
-    d) a neighbouring edge disclosed by the multi-detection mode. }
+  \caption{Detection of close edges with different sharpness:
+    a) input selection across the edges,
+    b) gradient map,
+    c) in single mode, detection of only the edge with the higher gradient,
+    d) in multi-detection mode, detection of both edges. }
   \label{fig:voisins}
 \end{figure}
 
@@ -194,8 +312,3 @@ the gradient magnitude with similar orientations.
   \caption{Automatic detection of blurred segments.}
   \label{fig:auto}
 \end{figure}
-
-% \subsection{Implementation details}
-%
-% A directional scanner is encoded as an iterator that provides successively
-% all the scan lines.
diff --git a/Article/notions.tex b/Article/notions.tex
index 50ffd13..3669175 100755
--- a/Article/notions.tex
+++ b/Article/notions.tex
@@ -59,9 +59,11 @@ domain $\mathcal{I}$ of a digital straight line $\mathcal{D}$,
 called the {\it scan strip}, into scans $S_i$, each of them being a segment
 of a naive line $\mathcal{N}_i$ orthogonal to $\mathcal{D}$.
 \begin{equation}
-DS = \left\{ S_i = \mathcal{D} \cap \mathcal{N}_i \cap \mathcal{I} |
-\delta(\mathcal{N}_i) = - \delta^{-1}(\mathcal{D})
-\cap h_0(\mathcal{N}_i) = h_0(\mathcal{N}_{i-1}) + p(\mathcal{D}) \right\}
+DS = \left\{ S_i = \mathcal{D} \cap \mathcal{N}_i \cap \mathcal{I}
+\left| \begin{array}{l}
+\delta(\mathcal{N}_i) = - \delta^{-1}(\mathcal{D}) \\
+\wedge~ h_0(\mathcal{N}_i) = h_0(\mathcal{N}_{i-1}) + p(\mathcal{D})
+\end{array} \right. \right\}
 %S_i = \mathcal{D} \cap \mathcal{N}_i, \mathcal{N}_i \perp \mathcal{D}
 \end{equation}
 In this expression, the clause
@@ -74,8 +76,10 @@ time.
 
 The scans $S_i$ are developed on each side of a start scan $S_0$,
 and ordered by their distance to the start line $\mathcal{N}_0$ with
-a positive (resp.  negative) sign if they are on the left (resp. right)
+a positive (resp. negative) sign if they are on the left (resp. right)
 side of $\mathcal{N}_0$.
+The directional scan is iterately processedfrom the start scan to both ends.
+At each iteration $i$, the scans $S_i$ and $S_{-1}$ are successively processed.
 
 \begin{figure}[h]
 \center
@@ -95,17 +99,17 @@ A directional scan can be defined by its start scan $S_0$.
 If $A(x_A,y_A)$ and $B(x_B,y_B)$ are the end points of $S_0$,
 the scan strip is defined by :
 \begin{equation}
-\mathcal{D}(A,B) = \mathcal{L}(\delta_x, \delta_y, min (c1,c2), 1 + |c_1-c_2|)
+\mathcal{D}(A,B) =
+\mathcal{L}(\delta_x,~ \delta_y,~ min (c1,c2),~ 1 + |c_1-c_2|)
 \end{equation}
 \noindent
 where $\delta_x = x_B - x_A$, $\delta_y = y_B - y_A$,
 $c_1 = \delta_x\cdot x_A + \delta_y\cdot y_A$ and
 $c_2 = \delta_x\cdot x_B + \delta_y\cdot y_B$.
-
 The scan line $\mathcal{N}_i$ is then defined by :
 \begin{equation}
-\mathcal{N}_i(A,B) = \mathcal{L}(\delta_y, -\delta_x,
-\delta_y\cdot x_A - \delta_x\cdot y_A + i\cdot \nu_{AB}, \nu_{AB})
+\mathcal{N}_i(A,B) = \mathcal{L}(\delta_y,~ -\delta_x,~
+\delta_y\cdot x_A - \delta_x\cdot y_A + i\cdot \nu_{AB},~ \nu_{AB})
 \end{equation}
 where $\nu_{AB} = max (|\delta_x|, |\delta_y|)$
 
@@ -115,132 +119,15 @@ where $\nu_{AB} = max (|\delta_x|, |\delta_y|)$
 %as the image bounds should also be processed anyway.
 
 A directional scan can also be defined by its central point $C(x_C,y_C)$,
-its direction $\vec{D}(x_D,y_D)$ and its width $w$. The scan strip is :
+its direction $\vec{D}(X_D,Y_D)$ and its width $w$. The scan strip is :
 \begin{equation}
 \mathcal{D}(C,\vec{D},w)
-= \mathcal{L}(y_D, -x_D, x_C\cdot y_D - y_C\cdot x_D - w / 2, w)
+= \mathcal{L}(Y_D,~ -X_D,~ x_C\cdot Y_D - y_C\cdot X_D - w / 2,~ w)
 \end{equation}
 
 \noindent
 and the scan line $\mathcal{N}_i(C,\vec{D},w)$ :
 \begin{equation}
-\mathcal{N}_i(C,\vec{D},w) = \mathcal{L}(x_D, y_D,
-     x_D\cdot x_C + y_D\cdot y_C - w / 2 + i\cdot w, max (|x_D|,|y_D|)
-\end{equation}
-
-\subsection{Adaptive directional scan}
-
-The blurred segment is searched within a directional scan with a position
-and an orientation approximately provided by the user, or blindly defined
-in unsupervised mode.
-Most of the time, the detection stops where the segment escapes sideways
-from the scan strip (\RefFig{fig:escape}).
-A second search is then run using another directional scan aligned
-on the detected segment.
-However, even in the case of an exact detection, the estimated orientation
-of the segment is subject to the numerization rounding,
-and the longer the real segment to detect, the higher the probability to
-fail again on a blurred segment escape from the directional scan.
-
-\begin{figure}[h]
-\center
-  \begin{tabular}{c}
-    \includegraphics[width=0.49\textwidth]{Fig_notions/escapeFirst_zoom.png}
-  \end{tabular}
-  \caption{Example of early detection failures
-           on side escapes from the directional scan.}
-  \label{fig:escape}
-\end{figure}
-
-%Even in ideal situation where the detected segment is a perfect line,
-%its width is never null as a result of the discretization process.
-%The estimated direction accuracy is mostly constrained by the length of
-%the detected segment.
-%To avoid these side escapes, the scan should not be a linear strip but
-%rather a conic shape to take into account the blurred segment preimage.
-%This side shift is amplified in situations where the blurred segment is
-%left free to get thicker in order to capture possible noisy features.
-%The assigned width is then still greater than the detected minimal width,
-%so that the segment can move within the directional scan.
-%Knowing the detected blurred segment shape and the image size, it is
-%possible to define a conic scan area, but this solution is computationaly
-%expensive because it leads to useless exploration of large image areas.
-%
-%\begin{figure}[h]
-%\center
-%  %\begin{picture}(300,40)
-%  %\end{picture}
-%  \input{Fig_notions/bscone}
-%  \caption{Possible extension area based
-%           on the detected blurred segment preimage.}
-%  \label{fig:cone}
-%\end{figure}
-
-In the former work, an additional refinement step is run using the better
-orientation estimated from the longer segment obtained.
-It is enough to completely detect most of the tested edges, but certainly
-not all, especially if larger images with much longer edges are processed.
-%The solution implemented in the former work was to let some arbitrary
-%margin between the scan strip width and the assigned width to the detection,
-%and to perform two fine detection steps, using for each of them the direction
-%found at the former step.
-This operation could be itered as long as the blurred segment escapes from
-the directional scanner using as any fine detection steps as necessary.
-But at each iteration, already tested points are processed again,
-thus producing a useless computational cost.
-
-Here the proposed solution is to dynamically align the scan direction to
-the blurred segment one all along the expansion stage.
-At each iteration $i+1$, the scan strip is updated using the direction
-of the blurred segment computed at previous iteration $i$.
-The adaptive directional scan $ADS$ is then defined by :
-\begin{equation}
-%S_i = \mathcal{D}_{i-1} \cap \mathcal{N}_i
-ADS = \left\{
-S_i = \mathcal{D}_i \cap \mathcal{N}_i \cap \mathcal{I}
-\left| \begin{array}{l}
-\delta(\mathcal{N}_i) = - \delta^{-1}(\mathcal{D}_0) \\
-\cap h_0(\mathcal{N}_i) = h_0(\mathcal{N}_{i-1}) + p(\mathcal{D}) \\
-\cap \mathcal{D}_{i+1} = D (\mathcal{B}_i,\varepsilon + k)
-\end{array} \right. \right\}
-\end{equation}
-where $D (\mathcal{B}_i,w)$ is the scan strip aligned to the
-detected segment at iteration $i$ with width $w$.
-In practice, the scan width is set a little greater than the assigned
-width $\varepsilon$ ($k$ is a constant arbitrarily set to 4).
-The last clause expresses the update of the scan bounds at iteration $i+1$.
-Compared to static directional scans, the scan strip moves while
-scan lines remain fixed.
-An example of adaptive directional scan is given in \RefFig{fig:adaption}.
-
-\begin{figure}[h]
-\center
-  \begin{tabular}{c@{\hspace{0.2cm}}c}
-    \includegraphics[width=0.49\textwidth]{Fig_notions/adaptionBounds_zoom.png}
-    & \includegraphics[width=0.49\textwidth]{Fig_notions/adaptionLines_zoom.png}
-  \end{tabular}
-  \caption{Example of blurred segment detection
-           using an adaptive directional scan.
-           On the right picture, the scan bounds are displayed in red, the
-           detected blurred segment in blue, and its bounding lines in green.
-           The left picture displays the successive scans.
-           Adaption is quite sensible when crossing the tile joins.}
-  \label{fig:adaption}
-\end{figure}
-
-\subsection{Control of the assigned width}
-
-The assigned width $\varepsilon$ to the blurred segment recognition algorithm
-is initially set to a large value $\varepsilon_0$ in order to allow the
-detection of large blurred segments.
-Then, when no more augmentation of the minimal width is observed after
-$\lambda$ iterations ($\mu_{i+\lambda} = \mu_i$), it is set to a much
-stricter value able to circumscribe the possible interpretations of the
-segment, that take into account the digitization margins:
-\begin{equation}
-\varepsilon = \mu_{i+\lambda} + 1/2
+\mathcal{N}_i(C,\vec{D},w) = \mathcal{L}(X_D,~ Y_D,~
+     X_D\cdot x_C + Y_D\cdot y_C - w / 2 + i\cdot w,~ max (|X_D|,|Y_D|)
 \end{equation}
-This strategy aims at preventing the incorporation of spurious outliers in
-further parts of the segment.
-Setting the observation distance to a constant value $\lambda = 20$ seems
-appropriate in most experimented situations.
-- 
GitLab