Skip to content
Snippets Groups Projects
Commit ed09c02a authored by even's avatar even
Browse files

Article: algoAuto debugged

parent fdb4fa4d
No related branches found
No related tags found
No related merge requests found
......@@ -24,21 +24,21 @@
\BlankLine
\bslist $\leftarrow$ \nullset\;
\mask $\leftarrow$ \nullset\;
$i \leftarrow$ \resol/2\;
\Repeat{$i <$ \iwidth/2}{
\bslist $\leftarrow$ \bslist + \multi (\pt(\iwidth/2-i,\iheight),
\pt(\iwidth/2-i,0), \mask)\;
\bslist $\leftarrow$ \bslist + \multi (\pt(\iwidth/2+i,\iheight),
\pt(\iwidth/2+i,0), \mask)\;
$i \leftarrow i -$ \resol\;
$x \leftarrow$ \resol/2\;
\Repeat{$x <$ \iwidth/2}{
\bslist $\leftarrow$ \bslist + \multi (\pt(\iwidth/2-x,\iheight),
\pt(\iwidth/2-x,0), \mask)\;
\bslist $\leftarrow$ \bslist + \multi (\pt(\iwidth/2+x,\iheight),
\pt(\iwidth/2+x,0), \mask)\;
$x \leftarrow x~+$ \resol\;
}
$i \leftarrow$ \resol/2\;
\Repeat{$i <$ \iheight/2}{
\bslist $\leftarrow$ \bslist + \multi (\pt(0,\iheight/2-i),
\pt(\iwidth,\iheight/2-i), \mask)\;
\bslist $\leftarrow$ \bslist + \multi (\pt(0,\iheight/2+i),
\pt(\iwidth,\iheight/2+i), \mask)\;
$i \leftarrow i -$ \resol\;
$y \leftarrow$ \resol/2\;
\Repeat{$y <$ \iheight/2}{
\bslist $\leftarrow$ \bslist + \multi (\pt(0,\iheight/2-y),
\pt(\iwidth,\iheight/2-y), \mask)\;
\bslist $\leftarrow$ \bslist + \multi (\pt(0,\iheight/2+y),
\pt(\iwidth,\iheight/2+y), \mask)\;
$y \leftarrow y~+$ \resol\;
}
\caption{AutoDetect: finds all blurred segments in the image.}
......
......@@ -115,6 +115,51 @@ void BSDetector::detectAll ()
}
void BSDetector::detectAllWithBalancedXY ()
{
autodet = true;
freeMultiSelection ();
gMap->setMasking (true);
bool isnext = true;
nbtrials = 0;
int width = gMap->getWidth ();
int height = gMap->getHeight ();
int xg = width / 2, yb = height / 2;
int xd = xg + autoResol, yh = yb + autoResol;
bool agauche = true, enbas = true, adroite = true, enhaut = true;
while (isnext && (agauche || enbas || adroite || enhaut))
{
if (agauche)
{
isnext = runMultiDetection (Pt2i (xg, 0), Pt2i (xg, height - 1));
xg -= autoResol;
if (xg <= 0) agauche = false;
}
if (isnext && enbas)
{
isnext = runMultiDetection (Pt2i (0, yb), Pt2i (width - 1, yb));
yb -= autoResol;
if (yb <= 0) enbas = false;
}
if (isnext && adroite)
{
isnext = runMultiDetection (Pt2i (xd, 0), Pt2i (xd, height - 1));
xd += autoResol;
if (xd >= width - 1) adroite = false;
}
if (isnext && enhaut)
{
isnext = runMultiDetection (Pt2i (0, yh), Pt2i (width - 1, yh));
yh += autoResol;
if (yh >= height - 1) enhaut = false;
}
}
gMap->clearMask ();
gMap->setMasking (false);
}
void BSDetector::detectSelection (const Pt2i &p1, const Pt2i &p2)
{
autodet = false;
......
......@@ -74,9 +74,16 @@ public:
/**
* \brief Detects all blurred segments in the picture.
* Parses X direction first, the Y direction.
*/
void detectAll ();
/**
* \brief Detects all blurred segments in the picture.
* Parses simultaneously the X and Y directions.
*/
void detectAllWithBalancedXY ();
/**
* \brief Detects blurred segments between two input points.
* @param p1 First input point.
......
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