Skip to content
Snippets Groups Projects
Unverified Commit d2060e86 authored by Kerautret Bertrand's avatar Kerautret Bertrand :thinking:
Browse files

edit output

parent b0eae20b
No related branches found
No related tags found
No related merge requests found
Code/Seg/IPOLdemo/Input/couloir.gif

111 KiB

...@@ -4,12 +4,41 @@ ...@@ -4,12 +4,41 @@
#include "bsdetector.h" #include "bsdetector.h"
#include "vmap.h" #include "vmap.h"
#include <iostream>
#include <fstream>
void usage(std::string str)
{
std::cout << str << " : something is wrong with the prog parameter (not enough parameters or something wrong)... "<< std::endl;
}
int main (int argc, char *argv[]) int main (int argc, char *argv[])
{ {
// Calcul de la carte de gradient (utilise qt) if (argc < 3)
{
usage(argv[0]);
exit(EXIT_FAILURE);
}
// getting parameters:
// - input file
string input_filename = argv[1];
// - output file
string output_filename = argv[2];
ofstream fout;
fout.open(output_filename, std::fstream::out);
// Calcul de la carte de gradient (utilise qt)
QImage image; QImage image;
image.load (QString ("../couloir.gif"));
image.load (QString (input_filename.c_str()));
int width = image.width (); int width = image.width ();
int height = image.height (); int height = image.height ();
int **tabImage = new int*[height]; int **tabImage = new int*[height];
...@@ -30,6 +59,8 @@ int main (int argc, char *argv[]) ...@@ -30,6 +59,8 @@ int main (int argc, char *argv[])
detector.setMaxTrials (-1); detector.setMaxTrials (-1);
detector.detectAll (); detector.detectAll ();
fout << "# Line detection generated from " << argv[0] << "with format : X1 Y1 X2 Y2 on each line" << std::endl;
// Affichage // Affichage
vector<BlurredSegment *> bss = detector.getBlurredSegments (); vector<BlurredSegment *> bss = detector.getBlurredSegments ();
if (! bss.empty ()) if (! bss.empty ())
...@@ -39,22 +70,30 @@ int main (int argc, char *argv[]) ...@@ -39,22 +70,30 @@ int main (int argc, char *argv[])
{ {
// Affichage du premier point // Affichage du premier point
vector<Pt2i> points = (*it)->getAllPoints (); vector<Pt2i> points = (*it)->getAllPoints ();
cout << "BS starts from (" << points.front().x()
<< "," << points.front().y() << ")" << endl; fout << points.front().x() << " " << points.front().y() << " "
<< points.back().x() << " " << points.back().y() << std::endl;
// Affichage du DSS englobant // Affichage du DSS englobant
vector<Pt2i> bnd; // vector<Pt2i> bnd;
DigitalStraightSegment *dss = (*it)->getSegment (); // DigitalStraightSegment *dss = (*it)->getSegment ();
if (dss != NULL) // if (dss != NULL)
{ // {
dss->getBounds (bnd, 0, 0, width, height);
cout << "DSS starts from (" << bnd.front().x() // dss->getBounds (bnd, 0, 0, width, height, false);
<< "," << bnd.front().y() << ")" << endl; // // cout << "DSS starts from (" << bnd.front().x()
} // // << "," << bnd.front().y() << ")" << endl;
// auto b = bnd.begin();
// for (auto &x: bnd){
// cout << "DSS starts from (" << x.x()
// << "," << x.y() << ")" << endl;
// }
// }
it++; it++;
} }
} }
fout.close();
return (0); return (0);
} }
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