Skip to content
Snippets Groups Projects
Commit 3aec0646 authored by Bigot Quentin's avatar Bigot Quentin
Browse files

modified hough2 algorithm + added detiq-t modifications

parent 95156633
No related branches found
No related tags found
No related merge requests found
...@@ -106,7 +106,7 @@ Image_t<double>* Transforms::hough2(const Image *image, double angleStep, double ...@@ -106,7 +106,7 @@ Image_t<double>* Transforms::hough2(const Image *image, double angleStep, double
// double imageDiag = image->getWidth() * sqrt(2.); // double imageDiag = image->getWidth() * sqrt(2.);
double imageDiag = sqrt(image->getWidth()*image->getWidth() + image->getHeight()*image->getHeight()); 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) { for(unsigned int c = 0; c < image->getNbChannels(); ++c) {
...@@ -118,12 +118,12 @@ Image_t<double>* Transforms::hough2(const Image *image, double angleStep, double ...@@ -118,12 +118,12 @@ Image_t<double>* Transforms::hough2(const Image *image, double angleStep, double
if(image->getPixelAt(i, j, c) == 255) if(image->getPixelAt(i, j, c) == 255)
{ {
//TODO : parcourir entre -180 et 90 //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 = cos(te * pi / 180.);
const double coste = 1;
//double sinte = sin(te * pi / 180.); double sinte = sin(te * pi / 180.);
double sinte=1 ;
// for(double ro = 0; ro < imageDiag; ro += rhoStep) // for(double ro = 0; ro < imageDiag; ro += rhoStep)
// { // {
...@@ -133,14 +133,14 @@ Image_t<double>* Transforms::hough2(const Image *image, double angleStep, double ...@@ -133,14 +133,14 @@ Image_t<double>* Transforms::hough2(const Image *image, double angleStep, double
// resImg->pixelAt(ro / rhoStep, te / angleStep)++; // 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 start = max(0., delta);
// const double end = min(imageDiag, delta + rhoStep); // const double end = min(imageDiag, delta + rhoStep);
// for(double ro = start; ro < end; ro += rhoStep) // for(double ro = start; ro < end; ro += rhoStep)
if(rho >= 0. && rho < imageDiag) 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)++;
} }
} }
} }
......
Subproject commit 69a111e904d12520d9c1e301b41a6debcf445711 Subproject commit 80da27102f24d1f5d018f819b590b926d34a56f3
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