From 70cc5a605b3294cea0421a99fb0f7c2b1db5d29d Mon Sep 17 00:00:00 2001 From: Kerautret <bertrand.kerautret@univ-lyon2.fr> Date: Sat, 22 Dec 2018 09:43:01 +0100 Subject: [PATCH] Demo Script pour interaction --- .../Scripts/displaySegmentsInteract.sh | 19 ++++++++ Code/Seg/IPOLdemo/mainIPOL.cpp | 47 +++++++++++++++++-- 2 files changed, 62 insertions(+), 4 deletions(-) create mode 100755 Code/Seg/IPOLdemo/Scripts/displaySegmentsInteract.sh diff --git a/Code/Seg/IPOLdemo/Scripts/displaySegmentsInteract.sh b/Code/Seg/IPOLdemo/Scripts/displaySegmentsInteract.sh new file mode 100755 index 0000000..6437cf7 --- /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 e8f1bc6..cce90bf 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 ()) -- GitLab