From 3aec0646f63ce9e05c5aac2b96a5156b2a62ee6b Mon Sep 17 00:00:00 2001 From: qbigot <quentin.bigot@insa-rennes.fr> Date: Wed, 5 Jul 2017 15:38:11 +0200 Subject: [PATCH] modified hough2 algorithm + added detiq-t modifications --- app/Operations/Transforms.cpp | 16 ++++++++-------- lib/detiq-t | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/Operations/Transforms.cpp b/app/Operations/Transforms.cpp index b2fd26b..12864cf 100644 --- a/app/Operations/Transforms.cpp +++ b/app/Operations/Transforms.cpp @@ -106,7 +106,7 @@ Image_t<double>* Transforms::hough2(const Image *image, double angleStep, double // double imageDiag = image->getWidth() * sqrt(2.); double imageDiag = sqrt(image->getWidth()*image->getWidth() + image->getHeight()*image->getHeight()); - Image_t<double>* resImg = new Image_t<double>(1. + imageDiag / rhoStep, 180. / angleStep + 0.5, image->getNbChannels(), 0.); + Image_t<double>* resImg = new Image_t<double>(1. + imageDiag / rhoStep, (180.+90) / angleStep + 0.5, image->getNbChannels(), 0.); for(unsigned int c = 0; c < image->getNbChannels(); ++c) { @@ -118,12 +118,12 @@ Image_t<double>* Transforms::hough2(const Image *image, double angleStep, double if(image->getPixelAt(i, j, c) == 255) { //TODO : parcourir entre -180 et 90 - for(double te=0; te < 180; te += angleStep) // on parcourt la matrice + for(double te=-90; te < 180; te += angleStep) // on parcourt la matrice { - //const double coste = cos(te * pi / 180.); - const double coste = 1; - //double sinte = sin(te * pi / 180.); - double sinte=1 ; + const double coste = cos(te * pi / 180.); + + double sinte = sin(te * pi / 180.); + // for(double ro = 0; ro < imageDiag; ro += rhoStep) // { @@ -133,14 +133,14 @@ Image_t<double>* Transforms::hough2(const Image *image, double angleStep, double // resImg->pixelAt(ro / rhoStep, te / angleStep)++; // } // } - const double rho = i * coste + j * sinte; + const double rho = i * coste + j * sinte; //(image->getHeight()-j) // const double start = max(0., delta); // const double end = min(imageDiag, delta + rhoStep); // for(double ro = start; ro < end; ro += rhoStep) if(rho >= 0. && rho < imageDiag) { - resImg->pixelAt(rho / rhoStep + 0.5, te / angleStep + 0.5, c)++; + resImg->pixelAt(rho / rhoStep + 0.5, (te+90) / angleStep + 0.5, c)++; } } } diff --git a/lib/detiq-t b/lib/detiq-t index 69a111e..80da271 160000 --- a/lib/detiq-t +++ b/lib/detiq-t @@ -1 +1 @@ -Subproject commit 69a111e904d12520d9c1e301b41a6debcf445711 +Subproject commit 80da27102f24d1f5d018f819b590b926d34a56f3 -- GitLab