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)
strucview = NULL;
profileview = NULL;
idetview = NULL;
// cannyview = NULL;
cannyview = NULL;
yorkview = NULL;
// Sets initial user outputs parameters
verbose = false;
......@@ -70,7 +71,8 @@ BSDetectionWidget::~BSDetectionWidget ()
if (strucview != NULL) delete strucview;
if (profileview != NULL) delete profileview;
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)
break;
case Qt::Key_Percent :
/*
cout << "CannyLine compares BS" << endl;
detector.detectAll ();
if (cannyview == NULL)
{
cannyview = new BSCannyView (&loadedImage, &detector);
}
cannyview->testBS ();
cannyview->show ();
cannyview->update ();
displayDetectionResult ();
cout << "CannyLine compares BS" << endl;
*/
break;
case Qt::Key_Ugrave :
/*
cout << "CannyLine compares DSS" << endl;
detector.detectAll ();
if (cannyview == NULL)
{
cannyview = new BSCannyView (&loadedImage, &detector);
}
cannyview->testDSS ();
cannyview->show ();
cannyview->update ();
displayDetectionResult ();
cout << "CannyLine compares DSS" << endl;
*/
case Qt::Key_Semicolon :
if (yorkview == NULL)
yorkview = new BSYorkView (&loadedImage, &detector);
yorkview->show ();
break;
case Qt::Key_Plus :
......@@ -990,6 +972,14 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event)
{
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 ()
void BSDetectionWidget::writeDetectionResult ()
{
BlurredSegment *bs = detector.getBlurredSegment ();
if (bs != NULL)
vector<BlurredSegment *> bss = detector.getBlurredSegments ();
if (bss.empty ())
{
ofstream outf ("seg.txt", ios::out);
outf << "(" << bs->antipodalEdgeStart().x ()
<< ", " << bs->antipodalEdgeStart().y ()
<< ") (" << bs->antipodalEdgeEnd().x ()
<< ", " << bs->antipodalEdgeEnd().y ()
<< ") (" << bs->antipodalVertex().x ()
<< ", " << bs->antipodalVertex().y ()
<< ") (" << bs->getLastLeft().x ()
<< ", " << bs->getLastLeft().y ()
<< ") (" << bs->getLastRight().x ()
<< ", " << bs->getLastRight().y ()
<< ")" << endl;
BlurredSegment *bs = detector.getBlurredSegment ();
if (bs != NULL)
{
ofstream outf ("seg.txt", ios::out);
outf << "(" << bs->antipodalEdgeStart().x ()
<< ", " << bs->antipodalEdgeStart().y ()
<< ") (" << bs->antipodalEdgeEnd().x ()
<< ", " << bs->antipodalEdgeEnd().y ()
<< ") (" << bs->antipodalVertex().x ()
<< ", " << bs->antipodalVertex().y ()
<< ") (" << bs->getLastLeft().x ()
<< ", " << 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 ();
}
}
......
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