diff --git a/Code/Seg/BSTools/bsaccumulatorview.cpp b/Code/Seg/BSTools/bsaccumulatorview.cpp index 5618ea4b91e0778ab049d36955d03df2613c76a4..a316774dfff21ca7973109d2f667f15fd98aeaa8 100755 --- a/Code/Seg/BSTools/bsaccumulatorview.cpp +++ b/Code/Seg/BSTools/bsaccumulatorview.cpp @@ -76,11 +76,11 @@ bool BSAccumulatorView::processKeyEvent (QKeyEvent *event) break; case Qt::Key_P : // Capture - viewport()->grab ( - QRect (QPoint (0, 0), - QSize (grid->getWidth(), grid->getHeight())) - ).toImage().save ("accu.png"); - cout << "Accumulator shot in capture.png" << endl; + // viewport()->grab ( + // QRect (QPoint (0, 0), + // QSize (grid->getWidth(), grid->getHeight())) + // ).toImage().save ("accu.png"); + // cout << "Accumulator shot in capture.png" << endl; break; } return processed; diff --git a/Code/Seg/BSTools/bsidetview.cpp b/Code/Seg/BSTools/bsidetview.cpp index 6b3beea667f6e326619ef14ca3c4fd58ef10889f..731e950a2231b2dbdb2a1369c4fbab75d60d1d42 100755 --- a/Code/Seg/BSTools/bsidetview.cpp +++ b/Code/Seg/BSTools/bsidetview.cpp @@ -53,10 +53,10 @@ bool BSIdetView::processKeyEvent (QKeyEvent *event) break; case Qt::Key_P : // Capture - viewport()->grab ( - QRect (QPoint (0, 0), - QSize (idet->getWidth(), idet->getHeight())) - ).toImage().save ("firstDetection.png"); + // viewport()->grab ( + // QRect (QPoint (0, 0), + // QSize (idet->getWidth(), idet->getHeight())) + // ).toImage().save ("firstDetection.png"); cout << "First detection window shot in capture.png" << endl; break; diff --git a/Code/Seg/BSTools/bsprofileview.cpp b/Code/Seg/BSTools/bsprofileview.cpp index 31208ffa7a0d1d0fa2c1a37ab2f63a1402694eb8..03cbb07bd46e90ec971a0a2c48b9b98bc0aad140 100755 --- a/Code/Seg/BSTools/bsprofileview.cpp +++ b/Code/Seg/BSTools/bsprofileview.cpp @@ -74,10 +74,10 @@ bool BSProfileView::processKeyEvent (QKeyEvent *event) break; case Qt::Key_P : // Capture - viewport()->grab ( - QRect (QPoint (0, 0), - QSize (prof->getWidth(), prof->getHeight())) - ).toImage().save ("profiles.png"); + // viewport()->grab ( + // QRect (QPoint (0, 0), + // QSize (prof->getWidth(), prof->getHeight())) + // ).toImage().save ("profiles.png"); cout << "Profiles shot in capture.png" << endl; break; diff --git a/Code/Seg/BSTools/bsstructureview.cpp b/Code/Seg/BSTools/bsstructureview.cpp index aec15cd446f7a07fc148a9dbca518b75e1bb1fc8..536234816dee6e9d1351a221efe1a2380ae1fd44 100755 --- a/Code/Seg/BSTools/bsstructureview.cpp +++ b/Code/Seg/BSTools/bsstructureview.cpp @@ -116,10 +116,10 @@ bool BSStructureView::processKeyEvent (QKeyEvent *event) break; case Qt::Key_P : // Capture - viewport()->grab ( - QRect (QPoint (0, 0), - QSize (grid->getWidth(), grid->getHeight())) - ).toImage().save ("structure.png"); + // viewport()->grab ( + // QRect (QPoint (0, 0), + // QSize (grid->getWidth(), grid->getHeight())) + // ).toImage().save ("structure.png"); cout << "Structure shot in capture.png" << endl; break; diff --git a/Code/Seg/IPOLdemo/IPOLdemo.pro b/Code/Seg/IPOLdemo/IPOLdemo.pro new file mode 100644 index 0000000000000000000000000000000000000000..a9b48d998ee8cdcdc9a3a5f90b900e0a57363ad1 --- /dev/null +++ b/Code/Seg/IPOLdemo/IPOLdemo.pro @@ -0,0 +1,97 @@ +###################################################################### +# Automatically generated by qmake (3.0) mer. nov. 7 21:11:32 2018 +###################################################################### + +QT+=widgets +TEMPLATE = app +TARGET = ipolDemo +INCLUDEPATH += .. \ + ../BSTools \ + ../BlurredSegment \ + ../DirectionalScanner \ + ../ConvexHull \ + ../ImageTools +OBJECTS_DIR = obj + +# Input +HEADERS += ../BlurredSegment/biptlist.h \ + ../BlurredSegment/blurredsegment.h \ + ../BlurredSegment/blurredsegmentproto.h \ + ../BlurredSegment/bsdetector.h \ + ../BlurredSegment/bstracker.h \ + ../BlurredSegment/linespacefilter.h \ + ../BSTools/bsaccumulatoritem.h \ + ../BSTools/bsaccumulatorview.h \ + ../BSTools/bsdetectionwidget.h \ + ../BSTools/bsidetitem.h \ + ../BSTools/bsidetview.h \ + ../BSTools/bsprofileitem.h \ + ../BSTools/bsprofileview.h \ + ../BSTools/bsstructureitem.h \ + ../BSTools/bsstructureview.h \ + ../BSTools/bswindow.h \ + ../ConvexHull/antipodal.h \ + ../ConvexHull/chvertex.h \ + ../ConvexHull/convexhull.h \ + ../DirectionalScanner/directionalscanner.h \ + ../DirectionalScanner/directionalscannero1.h \ + ../DirectionalScanner/directionalscannero2.h \ + ../DirectionalScanner/directionalscannero7.h \ + ../DirectionalScanner/directionalscannero8.h \ + ../DirectionalScanner/dynamicalscannero1.h \ + ../DirectionalScanner/dynamicalscannero2.h \ + ../DirectionalScanner/dynamicalscannero7.h \ + ../DirectionalScanner/dynamicalscannero8.h \ + ../DirectionalScanner/scannerprovider.h \ + ../DirectionalScanner/vhscannero1.h \ + ../DirectionalScanner/vhscannero2.h \ + ../DirectionalScanner/vhscannero7.h \ + ../DirectionalScanner/vhscannero8.h \ + ../ImageTools/absrat.h \ + ../ImageTools/digitalstraightline.h \ + ../ImageTools/digitalstraightsegment.h \ + ../ImageTools/pt2i.h \ + ../ImageTools/strucel.h \ + ../ImageTools/vmap.h \ + ../ImageTools/vr2i.h +SOURCES += mainIPOL.cpp \ + ../BlurredSegment/biptlist.cpp \ + ../BlurredSegment/blurredsegment.cpp \ + ../BlurredSegment/blurredsegmentproto.cpp \ + ../BlurredSegment/bsdetector.cpp \ + ../BlurredSegment/bstracker.cpp \ + ../BlurredSegment/linespacefilter.cpp \ + ../BSTools/bsaccumulatoritem.cpp \ + ../BSTools/bsaccumulatorview.cpp \ + ../BSTools/bsdetectionwidget.cpp \ + ../BSTools/bsidetitem.cpp \ + ../BSTools/bsidetview.cpp \ + ../BSTools/bsprofileitem.cpp \ + ../BSTools/bsprofileview.cpp \ + ../BSTools/bsstructureitem.cpp \ + ../BSTools/bsstructureview.cpp \ + ../BSTools/bswindow.cpp \ + ../ConvexHull/antipodal.cpp \ + ../ConvexHull/chvertex.cpp \ + ../ConvexHull/convexhull.cpp \ + ../DirectionalScanner/directionalscanner.cpp \ + ../DirectionalScanner/directionalscannero1.cpp \ + ../DirectionalScanner/directionalscannero2.cpp \ + ../DirectionalScanner/directionalscannero7.cpp \ + ../DirectionalScanner/directionalscannero8.cpp \ + ../DirectionalScanner/dynamicalscannero1.cpp \ + ../DirectionalScanner/dynamicalscannero2.cpp \ + ../DirectionalScanner/dynamicalscannero7.cpp \ + ../DirectionalScanner/dynamicalscannero8.cpp \ + ../DirectionalScanner/scannerprovider.cpp \ + ../DirectionalScanner/vhscannero1.cpp \ + ../DirectionalScanner/vhscannero2.cpp \ + ../DirectionalScanner/vhscannero7.cpp \ + ../DirectionalScanner/vhscannero8.cpp \ + ../ImageTools/absrat.cpp \ + ../ImageTools/digitalstraightline.cpp \ + ../ImageTools/digitalstraightsegment.cpp \ + ../ImageTools/pt2i.cpp \ + ../ImageTools/strucel.cpp \ + ../ImageTools/vmap.cpp \ + ../ImageTools/vr2i.cpp 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 new file mode 100755 index 0000000000000000000000000000000000000000..013bdc6714e804bf562e37e669944c4aac117b16 --- /dev/null +++ b/Code/Seg/IPOLdemo/mainIPOL.cpp @@ -0,0 +1,99 @@ +#include <QImage> +#include <QString> +#include <QColor> +#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[]) +{ + 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.c_str(), std::fstream::out); + + +// Calcul de la carte de gradient (utilise qt) + QImage image; + + image.load (QString (input_filename.c_str())); + int width = image.width (); + int height = image.height (); + int **tabImage = new int*[height]; + for (int i = 0; i < height; i++) + { + tabImage[i] = new int[width]; + for(int j = 0; j < width; j++) + { + QColor c = QColor (image.pixel (j, height - i - 1)); + tabImage[i][j] = c.value (); + } + } + VMap *gMap = new VMap (width, height, tabImage, VMap::TYPE_SOBEL_5X5); + + // Detection + BSDetector detector; + detector.setGradientMap (gMap); + 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 ()) + { + vector<BlurredSegment *>::const_iterator it = bss.begin (); + while (it != bss.end ()) + { + // Affichage du premier point + vector<Pt2i> points = (*it)->getAllPoints (); + + 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, 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); +} diff --git a/Code/Seg/mainIPOL.cpp b/Code/Seg/mainIPOL.cpp deleted file mode 100755 index 377e4352d301aa57e73e8591f10caac63d2651d4..0000000000000000000000000000000000000000 --- a/Code/Seg/mainIPOL.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include <QImage> -#include <QString> -#include <QColor> -#include "bsdetector.h" -#include "vmap.h" - - -int main (int argc, char *argv[]) -{ - // Calcul de la carte de gradient (utilise qt) - QImage image; - image.load (QString ("../couloir.gif")); - int width = image.width (); - int height = image.height (); - int **tabImage = new int*[height]; - for (int i = 0; i < height; i++) - { - tabImage[i] = new int[width]; - for(int j = 0; j < width; j++) - { - QColor c = QColor (image.pixel (j, height - i - 1)); - tabImage[i][j] = c.value (); - } - } - VMap *gMap = new VMap (width, height, tabImage, VMap::TYPE_SOBEL_5X5); - - // Detection - BSDetector detector; - detector.setGradientMap (gMap); - detector.setMaxTrials (-1); - detector.detectAll (); - - // Affichage - vector<BlurredSegment *> bss = detector.getBlurredSegments (); - if (! bss.empty ()) - { - vector<BlurredSegment *>::const_iterator it = bss.begin (); - while (it != bss.end ()) - { - // Affichage du premier point - vector<Pt2i> points = (*it)->getAllPoints (); - cout << "BS starts from (" << points.front().x() - << "," << points.front().y() << ")" << 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; - } - - it++; - } - } - - return (0); -}