Skip to content
Snippets Groups Projects
Commit c5a10112 authored by even's avatar even
Browse files

main IPOL

parent 11e99367
No related branches found
No related tags found
No related merge requests found
#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);
}
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