From 3ce2be6e3d16b79f7df05142cbf32656c4933a23 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 5 Jan 2016 18:27:06 +0100 Subject: [PATCH] [TASK] Seperate generation of gauss blur filters. --- canny_edge_machine.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/canny_edge_machine.cpp b/canny_edge_machine.cpp index 2cd0506..00cd60f 100644 --- a/canny_edge_machine.cpp +++ b/canny_edge_machine.cpp @@ -81,12 +81,12 @@ class CannyEdgeMachine { } }; - void doGaussBlur(void) { - int filter_width = this->filter_size; - double sigma = this->filter_sigma; - // build the gauss filter + /** + * Do not forget to free the filter generated by this method! + */ + double* generateGaussFilter(int filter_width, double sigma, double& sum_weights) { double* filter = (double*) malloc(sizeof(double) * filter_width * filter_width); - double sum_weights = 0; + sum_weights = 0; std::cout << "Using gauss filter: " << std::endl; for(int x=0; xfilter_size; + // build the gauss filter + double sum_weights = 0.0; + double* filter = this->generateGaussFilter(this->filter_size, this->filter_sigma, sum_weights); + std::cout << sum_weights << std::endl; // apply gauss filter int filter_offset = (filter_width+1)/2; for(int x=(0+filter_offset); x<(this->width-filter_offset); x++) {