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

Assigned thickness control

parent eed9b1ce
Branches
No related tags found
No related merge requests found
......@@ -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 () +
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 << "Input max width = " << detector.getInputMaxWidth () << endl;
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 :
......
......@@ -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 = ")
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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. */
......
......@@ -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);
......
......@@ -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). */
......
......@@ -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 \\
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment