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

Add detected multisegments output

parent f668c486
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,8 @@ BSDetectionWidget::BSDetectionWidget (QWidget *parent) ...@@ -35,7 +35,8 @@ BSDetectionWidget::BSDetectionWidget (QWidget *parent)
strucview = NULL; strucview = NULL;
profileview = NULL; profileview = NULL;
idetview = NULL; idetview = NULL;
// cannyview = NULL; cannyview = NULL;
yorkview = NULL;
// Sets initial user outputs parameters // Sets initial user outputs parameters
verbose = false; verbose = false;
...@@ -70,7 +71,8 @@ BSDetectionWidget::~BSDetectionWidget () ...@@ -70,7 +71,8 @@ BSDetectionWidget::~BSDetectionWidget ()
if (strucview != NULL) delete strucview; if (strucview != NULL) delete strucview;
if (profileview != NULL) delete profileview; if (profileview != NULL) delete profileview;
if (idetview != NULL) delete idetview; if (idetview != NULL) delete idetview;
// if (cannyview != NULL) delete cannyview; if (cannyview != NULL) delete cannyview;
if (yorkview != NULL) delete yorkview;
} }
...@@ -838,35 +840,15 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event) ...@@ -838,35 +840,15 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event)
break; break;
case Qt::Key_Percent : case Qt::Key_Percent :
/*
cout << "CannyLine compares BS" << endl;
detector.detectAll ();
if (cannyview == NULL) if (cannyview == NULL)
{
cannyview = new BSCannyView (&loadedImage, &detector); cannyview = new BSCannyView (&loadedImage, &detector);
}
cannyview->testBS ();
cannyview->show (); cannyview->show ();
cannyview->update ();
displayDetectionResult ();
cout << "CannyLine compares BS" << endl;
*/
break; break;
case Qt::Key_Ugrave : case Qt::Key_Semicolon :
/* if (yorkview == NULL)
cout << "CannyLine compares DSS" << endl; yorkview = new BSYorkView (&loadedImage, &detector);
detector.detectAll (); yorkview->show ();
if (cannyview == NULL)
{
cannyview = new BSCannyView (&loadedImage, &detector);
}
cannyview->testDSS ();
cannyview->show ();
cannyview->update ();
displayDetectionResult ();
cout << "CannyLine compares DSS" << endl;
*/
break; break;
case Qt::Key_Plus : case Qt::Key_Plus :
...@@ -990,6 +972,14 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event) ...@@ -990,6 +972,14 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event)
{ {
if (idetview->processKeyEvent (event)) extract (); if (idetview->processKeyEvent (event)) extract ();
} }
else if (yorkview != NULL && yorkview->isActiveWindow ())
{
if (yorkview->processKeyEvent (event)) extract ();
}
else if (cannyview != NULL && cannyview->isActiveWindow ())
{
if (cannyview->processKeyEvent (event)) extract ();
}
} }
...@@ -1145,21 +1135,46 @@ void BSDetectionWidget::writeTest () ...@@ -1145,21 +1135,46 @@ void BSDetectionWidget::writeTest ()
void BSDetectionWidget::writeDetectionResult () void BSDetectionWidget::writeDetectionResult ()
{ {
BlurredSegment *bs = detector.getBlurredSegment (); vector<BlurredSegment *> bss = detector.getBlurredSegments ();
if (bs != NULL) if (bss.empty ())
{ {
ofstream outf ("seg.txt", ios::out); BlurredSegment *bs = detector.getBlurredSegment ();
outf << "(" << bs->antipodalEdgeStart().x () if (bs != NULL)
<< ", " << bs->antipodalEdgeStart().y () {
<< ") (" << bs->antipodalEdgeEnd().x () ofstream outf ("seg.txt", ios::out);
<< ", " << bs->antipodalEdgeEnd().y () outf << "(" << bs->antipodalEdgeStart().x ()
<< ") (" << bs->antipodalVertex().x () << ", " << bs->antipodalEdgeStart().y ()
<< ", " << bs->antipodalVertex().y () << ") (" << bs->antipodalEdgeEnd().x ()
<< ") (" << bs->getLastLeft().x () << ", " << bs->antipodalEdgeEnd().y ()
<< ", " << bs->getLastLeft().y () << ") (" << bs->antipodalVertex().x ()
<< ") (" << bs->getLastRight().x () << ", " << bs->antipodalVertex().y ()
<< ", " << bs->getLastRight().y () << ") (" << bs->getLastLeft().x ()
<< ")" << endl; << ", " << bs->getLastLeft().y ()
<< ") (" << bs->getLastRight().x ()
<< ", " << bs->getLastRight().y ()
<< ")" << endl;
outf.close ();
}
}
else
{
ofstream outf ("segs.txt", ios::out);
vector<BlurredSegment *>::iterator it = bss.begin ();
while (it != bss.end ())
{
outf << "(" << (*it)->antipodalEdgeStart().x ()
<< ", " << (*it)->antipodalEdgeStart().y ()
<< ") (" << (*it)->antipodalEdgeEnd().x ()
<< ", " << (*it)->antipodalEdgeEnd().y ()
<< ") (" << (*it)->antipodalVertex().x ()
<< ", " << (*it)->antipodalVertex().y ()
<< ") (" << (*it)->getLastLeft().x ()
<< ", " << (*it)->getLastLeft().y ()
<< ") (" << (*it)->getLastRight().x ()
<< ", " << (*it)->getLastRight().y ()
<< ")" << endl;
it++;
}
outf.close (); outf.close ();
} }
} }
......
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