Skip to content
Snippets Groups Projects
Commit 178a0802 authored by ariotte's avatar ariotte
Browse files

fixed axis in hough transform

parent ee04bebb
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,7 @@ const double pi = 3.1415926535897932384626433832795;
const double pid2 = 1.57079632679489661923132169163975144209858469968755291;
const double sqrt2 = 1.414213562373095048801688724209698078569671875376948;
Image_t<double>* Transforms::hough(const GrayscaleImage *image ) { //TODO : inverser i et j i (ligne) et j (colonne)
Image_t<double>* Transforms::hough(const GrayscaleImage *image ) {
double diag = sqrt(image->getWidth()*image->getWidth() + image->getHeight()*image->getHeight());
......@@ -187,7 +187,6 @@ string Transforms::hough2_inverse(const Image_t<double> *image, Image** resImgpt
//Algorithme de traitement
int cmpt = 0;
for(unsigned int c = 0; c < image->getNbChannels(); ++c) {
for(unsigned int i = 0; i < image->getHeight(); ++i) {
for(unsigned int j = 0; j < image->getWidth(); ++j) {
......@@ -195,13 +194,12 @@ string Transforms::hough2_inverse(const Image_t<double> *image, Image** resImgpt
int n = image->getPixelAt(j, i, c);
if(n >= threshold)
{
cmpt++;
double angle = pi * (j * angleStep - 90) / 180 ;
double rho = rhoStep * i - imageDiag;
double sinte = sin(angle);
double coste = cos(angle);
//Construction de la droite d'quation rho = x*coste + y*sinte
//Construction de la droite d'equation rho = x*coste + y*sinte
for(unsigned int jj = 0; jj < height; ++jj) {
double x = jj;
double y = (rho - x*coste)/sinte;
......@@ -224,9 +222,6 @@ string Transforms::hough2_inverse(const Image_t<double> *image, Image** resImgpt
}
}
// sprintf( tampon,"\nNombre de droites traces=%d",cmpt);
// strcat( buffer, tampon);
//On applique une mise à l'echelle de l'image pour mettre la valeur max a 255
std::cout << resImg->max() << std::endl;
Image* resStdImg = new Image(resImg->getWidth(), resImg->getHeight(), resImg->getNbChannels());
......
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