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

Demo Script pour interaction

parent bf05ab97
No related branches found
No related tags found
No related merge requests found
#!/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
......@@ -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 ())
......
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