|
|
@@ -3,7 +3,7 @@
|
|
|
#include <math.h>
|
|
|
#define M_PI 3.14159265358979323846
|
|
|
#include "../tp2.h"
|
|
|
-#define DEBUG 1
|
|
|
+#define DEBUG 0
|
|
|
/**
|
|
|
* Calculo la matriz de convulsión.
|
|
|
* Hago el calculo de todos los componentes.
|
|
|
@@ -17,8 +17,9 @@ float* convulcion_matrix(float sigma, int r) {
|
|
|
unsigned int tam = diff*largo;
|
|
|
float* conv_matrix = malloc(sizeof(float)*tam);
|
|
|
|
|
|
- if (DEBUG)
|
|
|
+ #if DEBUG
|
|
|
printf("Sigma: %f | Radio: %d \n", sigma,r);
|
|
|
+ #endif
|
|
|
// Recorro cada pixel
|
|
|
for (int y = -r; y <= r; y++) {
|
|
|
for (int x = -r; x <= r+1; x++) {
|
|
|
@@ -28,12 +29,14 @@ float* convulcion_matrix(float sigma, int r) {
|
|
|
} else {
|
|
|
conv_matrix[contador] = (1 / (2*M_PI*sigma*sigma)) * exp(- (pow(x,2)+pow(y,2))/(2*sigma*sigma));
|
|
|
}
|
|
|
- if (DEBUG)
|
|
|
+ #if DEBUG
|
|
|
printf("%.8f\t", conv_matrix[contador]);
|
|
|
+ #endif
|
|
|
contador++;
|
|
|
}
|
|
|
- if (DEBUG)
|
|
|
+ #if DEBUG
|
|
|
printf("\n");
|
|
|
+ #endif
|
|
|
}
|
|
|
return conv_matrix;
|
|
|
}
|