diff --git a/Code/Seg/IPOLdemo/Input/couloir.gif b/Code/Seg/IPOLdemo/Input/couloir.gif new file mode 100644 index 0000000000000000000000000000000000000000..9489eff401ac290ddd0f796930b747a59ec43982 Binary files /dev/null and b/Code/Seg/IPOLdemo/Input/couloir.gif differ diff --git a/Code/Seg/IPOLdemo/mainIPOL.cpp b/Code/Seg/IPOLdemo/mainIPOL.cpp index 377e4352d301aa57e73e8591f10caac63d2651d4..703b2ddeb08c4d19938127fcc699664ab93b9a39 100755 --- a/Code/Seg/IPOLdemo/mainIPOL.cpp +++ b/Code/Seg/IPOLdemo/mainIPOL.cpp @@ -4,12 +4,41 @@ #include "bsdetector.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[]) { - // 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; - image.load (QString ("../couloir.gif")); + + image.load (QString (input_filename.c_str())); int width = image.width (); int height = image.height (); int **tabImage = new int*[height]; @@ -30,6 +59,8 @@ int main (int argc, char *argv[]) detector.setMaxTrials (-1); detector.detectAll (); + fout << "# Line detection generated from " << argv[0] << "with format : X1 Y1 X2 Y2 on each line" << std::endl; + // Affichage vector<BlurredSegment *> bss = detector.getBlurredSegments (); if (! bss.empty ()) @@ -39,22 +70,30 @@ int main (int argc, char *argv[]) { // Affichage du premier point 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 - vector<Pt2i> bnd; - DigitalStraightSegment *dss = (*it)->getSegment (); - if (dss != NULL) - { - dss->getBounds (bnd, 0, 0, width, height); - cout << "DSS starts from (" << bnd.front().x() - << "," << bnd.front().y() << ")" << endl; - } + // vector<Pt2i> bnd; + // DigitalStraightSegment *dss = (*it)->getSegment (); + // if (dss != NULL) + // { + + // dss->getBounds (bnd, 0, 0, width, height, false); + // // 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++; } } - + fout.close(); return (0); }