From 66e2ae8d304a7d357133d161bf9a67996e18c46e Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 5 Jan 2016 18:21:22 +0100 Subject: [PATCH] [TASK] Fix gauss filter not being centered. --- canny_edge_machine.cpp | 4 +++- imageviewer-qt4.cpp | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/canny_edge_machine.cpp b/canny_edge_machine.cpp index c11bbfc..2cd0506 100644 --- a/canny_edge_machine.cpp +++ b/canny_edge_machine.cpp @@ -89,8 +89,10 @@ class CannyEdgeMachine { double sum_weights = 0; std::cout << "Using gauss filter: " << std::endl; for(int x=0; xgauss(x, y, sigma); + int j = y - (filter_width/2); + filter[x*filter_width + y] = this->gauss(i, j, sigma); sum_weights += filter[x*filter_width + y]; std::cout << "(" << x << ", " << y << ") " << filter[x*filter_width + y] << " | "; } diff --git a/imageviewer-qt4.cpp b/imageviewer-qt4.cpp index 3b03efd..7990bde 100644 --- a/imageviewer-qt4.cpp +++ b/imageviewer-qt4.cpp @@ -726,6 +726,9 @@ void ImageViewer::doUnsharpMasking(void) { int gauss_width = usm_gauss_width->value(); logFile << "Doing USM using gauss width of " << gauss_width << " and alpha of " << alpha << std::endl; renewLogging(); + + + updateImageDisplay(); } /****************************************************************************************