diff --git a/Code/Seg/IPOLdemo/Scripts/displaySegmentsInteract.sh b/Code/Seg/IPOLdemo/Scripts/displaySegmentsInteract.sh new file mode 100755 index 0000000000000000000000000000000000000000..6437cf777b83644fb0684e7b57f1efe008b6f57d --- /dev/null +++ b/Code/Seg/IPOLdemo/Scripts/displaySegmentsInteract.sh @@ -0,0 +1,19 @@ +#!/bin/sh +PATH=/usr/bin/:/usr/local/bin:/opt/local/bin +LD_LIBRARY_PATH=/home/kerautre/DGtal/build/src:/home/kerautre/libQGLViewer-2.6.4/QGLViewer +export LD_LIBRARY_PATH + +BG_IMAGE=$1 +LINE_FILE=$2 +INPUT_LINESEED=$3 +OUT_FILE_BASENAME=$4 + + + + +displayLineSegments -i ${LINE_FILE} --customLineColor 50 50 200 --backgroundImage ${BG_IMAGE} -o ${OUT_FILE_BASENAME}.fig -s ${INPUT_LINESEED} --customLineColorSecSet 200 50 50 --customPointColor 50 200 50 --lineWidth 2 --lineWidthSecSet 3 --noDisplayEndPoints +fig2dev -L eps ${OUT_FILE_BASENAME}.fig ${OUT_FILE_BASENAME}.eps +convert -background \#FFFFFF -flatten ${OUT_FILE_BASENAME}.eps -geometry 512x ${OUT_FILE_BASENAME}.png + + + diff --git a/Code/Seg/IPOLdemo/mainIPOL.cpp b/Code/Seg/IPOLdemo/mainIPOL.cpp index e8f1bc6392d20c761afc3b83bd71406353281a35..cce90bfb94c8911ee0b191a58fb6c53ecb8a590a 100755 --- a/Code/Seg/IPOLdemo/mainIPOL.cpp +++ b/Code/Seg/IPOLdemo/mainIPOL.cpp @@ -73,9 +73,17 @@ int main (int argc, char *argv[]) { while (reading) { - fin >> val[i++]; - if (val[i-1] == -1) reading = false; - // if (fin.eof ()) reading = false; + if (fin.eof()) + { + reading = false; + } + else + { + fin >> skipws >> val[i++]; + } + //if (val[i-1] == -1) reading = false; + //if (fin.eof()) continue; + if (reading && i == 4) { pts.push_back (Pt2i (val[0], val[1])); @@ -85,7 +93,9 @@ int main (int argc, char *argv[]) } } fin.close(); + cout << "siez i:"<< pts.size() << endl; } + fout << "# Line detection generated from " << argv[0] << "with format : X1 Y1 X2 Y2 on each line" << std::endl; // Blurred segment detection vector<BlurredSegment *> bss; @@ -110,6 +120,35 @@ int main (int argc, char *argv[]) nbseg ++; } } + 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++; + } + std::cout << nbseg << " detections" << std::endl; } else @@ -119,7 +158,7 @@ int main (int argc, char *argv[]) bss = detector.getBlurredSegments (); } - fout << "# Line detection generated from " << argv[0] << "with format : X1 Y1 X2 Y2 on each line" << std::endl; + // Display if (! bss.empty ())