Skip to content
Snippets Groups Projects
Commit d67b6d71 authored by evenp's avatar evenp
Browse files

First algo update

parent 41bdc6e3
No related branches found
No related tags found
No related merge requests found
...@@ -11,9 +11,10 @@ ...@@ -11,9 +11,10 @@
\SetKwData{ath}{$\varepsilon$} \SetKwData{ath}{$\varepsilon$}
\SetKwData{on}{isExtending} \SetKwData{on}{isExtending}
%\SetKwData{nb}{$n_E$} %\SetKwData{nb}{$n_E$}
\SetKwData{side}{side} \SetKwData{side}{$side$}
\SetKwData{index}{$I$} \SetKwData{index}{$I$}
\SetKwData{ninter}{$n_I$} \SetKwData{ninter}{$n_I$}
\SetKwData{niside}{$n_I[side]$}
%\SetKwData{nbin}{$N_{inter}$} %\SetKwData{nbin}{$N_{inter}$}
\SetKwData{imax}{$N_I$} \SetKwData{imax}{$N_I$}
\SetKwData{gdiff}{$\delta_G$} \SetKwData{gdiff}{$\delta_G$}
...@@ -66,10 +67,9 @@ ...@@ -66,10 +67,9 @@
\bs \takes \bsinit (\scan$[$\index$[$0$]]$, \ath) \bs \takes \bsinit (\scan$[$\index$[$0$]]$, \ath)
\nb \takes 0\; \nb \takes 0\;
\ninter \takes 0\;
\pinchcount \takes 0\; \pinchcount \takes 0\;
\on \takes (true, true)\; \ninter \takes (0, 0)\;
\While{\on $\neq$ (false, false)}{ \While{\ninter $\neq$ (\imax, \imax)}{
\nb \takes \nb + 1\; \nb \takes \nb + 1\;
\bsth \takes \thickness(\bs)\; \bsth \takes \thickness(\bs)\;
\If{\pinchcount = \pinchdelay}{ \If{\pinchcount = \pinchdelay}{
...@@ -83,25 +83,24 @@ ...@@ -83,25 +83,24 @@
\Comment*{Aligns scan stripe on blurred segment.} \Comment*{Aligns scan stripe on blurred segment.}
} }
\ForEach{\side}{ \ForEach{\side}{
\If{\on$[$\side$]$}{ \If{\niside $\leq$ \imax}{
\scan \takes \nscan (\ds, \side)\; \scan \takes \nscan (\ds, \side)\;
\index \takes \locmax (\scan, \gmap, \gdiff, \vmap, \dirn)\; \index \takes \locmax (\scan, \gmap, \gdiff, \vmap, \dirn)\;
\trial \takes false\;
\added \takes false\; \added \takes false\;
\While{\added = false and \trial $<$ \size(\index)}{ \While{\added = false and \trial $<$ \size(\index)}{
\added \takes \addpt (\bs, \scan$[$\index$[$\trial$]]$) \added \takes \addpt (\bs, \scan$[$\index$[$\trial$]]$)
\Comment*{Tests BS extension} \Comment*{Tests BS extension}
\trial \takes \trial + 1\;
} }
\pinchcount \takes \pinchcount + 1\; \pinchcount \takes \pinchcount + 1\;
\eIf{\added}{ \eIf{\added}{
\If{\pinchcount $<$ \pinchdelay and \bsth $<$ \thickness(\bs)}{ \If{\pinchcount $<$ \pinchdelay and \bsth $<$ \thickness(\bs)}{
\pinchcount \takes 0 \Comment*{Not yet stabilized.} \pinchcount \takes 0 \Comment*{Not yet stabilized.}
} }
\ninter \takes 0 \Comment*{Resets fail count.} \niside \takes 0 \Comment*{Resets fail count.}
}{ }{
\ninter \takes \ninter + 1 \Comment*{Increments extension count.} \niside \takes \niside + 1 \Comment*{Increments fail count.}
\If{\ninter $>$ \imax}{
\on$[$\side$]$ \takes false \Comment*{Stops BS extension}
}
} }
} }
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
\SetKwData{side}{side} \SetKwData{side}{side}
\SetKwData{index}{$i$} \SetKwData{index}{$i$}
\SetKwData{ninter}{$n_I$} \SetKwData{ninter}{$n_I$}
\SetKwData{niside}{$n_I[side]$}
\SetKwData{imax}{$N_I$} \SetKwData{imax}{$N_I$}
\SetKwData{nmax}{$N_E$} \SetKwData{nmax}{$N_E$}
\SetKwData{gmin}{$G_{min}$} \SetKwData{gmin}{$G_{min}$}
...@@ -32,33 +33,33 @@ ...@@ -32,33 +33,33 @@
\Output{a detected blurred segment \bs} \Output{a detected blurred segment \bs}
\bs \takes $\emptyset$\; \bs \takes $\emptyset$\;
\ds \takes \getds (\is) \Comment*{Gets a DS from input segment} \ds \takes \getds (\is)
\Comment*{Gets a DS from input segment.}
\scan \takes \fscan (\ds)\; \scan \takes \fscan (\ds)\;
\index \takes \largest (\scan, \gmap, \gmin) \index \takes \largest (\scan, \gmap, \gmin)
\Comment*{Gets index of pixel with max gradient} \Comment*{Gets index of pixel with max gradient.}
\If{\grad(\gmap$[$\scan$[$\index$]]$) $\geq$ \gmin}{ \If{\grad(\gmap$[$\scan$[$\index$]]$) $\geq$ \gmin}{
\bs \takes \bsinit (\scan$[$\index$]$, \ath) \bs \takes \bsinit (\scan$[$\index$]$, \ath)
\ninter \takes 0\;
\nb \takes 0\; \nb \takes 0\;
\on \takes (true, true)\; \ninter \takes (0, 0)
\While{\on $\neq$ (false, false) and \nb $\neq$ \nmax \Comment*{One counter for each side.}
\While{\ninter $\neq$ (\imax, \imax) and \nb $\neq$ \nmax
\Comment*{No more than \nmax extent.}}{ \Comment*{No more than \nmax extent.}}{
\ForEach{\side}{ \ForEach{\side}{
\If{\on$[$\side$]$}{ \If{\niside $\leq$ \imax}{
\scan \takes \nscan (\ds, \side)\; \scan \takes \nscan (\ds, \side)\;
\index \takes \largest (\scan, \gmap)\; \index \takes \largest (\scan, \gmap)\;
\eIf{\addpt (\bs, \scan$[$\index$]$) \Comment*{Tests BS extension}}{ \eIf{\addpt (\bs, \scan$[$\index$]$) \Comment*{Tests BS extension.}}{
\ninter \takes 0 \Comment*{Resets fail count.} \niside \takes 0 \Comment*{Resets fail count.}
}{ }{
\ninter \takes \ninter + 1 \Comment*{Increments extension count.} \niside \takes \niside + 1
\If{\ninter $>$ \imax}{ \Comment*{Increments fail count.}
\on$[$\side$]$ \takes false \Comment*{Stops BS extension}
}
} }
} }
} }
\nb \takes \nb + 1\; \nb \takes \nb + 1
\Comment*{Increments extension count.}
} }
} }
\label{algo:initial} \label{algo:initial}
......
all:
@echo "ps pdf release"
make pdf
pdf:
pdflatex article
bibtex article
pdflatex article
pdflatex article
clean:
rm -f article.pdf article.ps article.dvi article.log article.out article.bbl article.blg article.aux *~
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment