[TASK] Fix gauss filter not being centered.

This commit is contained in:
Jan Philipp Timme 2016-01-05 18:21:22 +01:00
parent e7b745c19a
commit 66e2ae8d30
2 changed files with 6 additions and 1 deletions

View File

@ -89,8 +89,10 @@ class CannyEdgeMachine {
double sum_weights = 0; double sum_weights = 0;
std::cout << "Using gauss filter: " << std::endl; std::cout << "Using gauss filter: " << std::endl;
for(int x=0; x<filter_width; x++) { for(int x=0; x<filter_width; x++) {
int i = x - (filter_width/2);
for(int y=0; y<filter_width; y++) { for(int y=0; y<filter_width; y++) {
filter[x*filter_width + y] = this->gauss(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]; sum_weights += filter[x*filter_width + y];
std::cout << "(" << x << ", " << y << ") " << filter[x*filter_width + y] << " | "; std::cout << "(" << x << ", " << y << ") " << filter[x*filter_width + y] << " | ";
} }

View File

@ -726,6 +726,9 @@ void ImageViewer::doUnsharpMasking(void) {
int gauss_width = usm_gauss_width->value(); int gauss_width = usm_gauss_width->value();
logFile << "Doing USM using gauss width of " << gauss_width << " and alpha of " << alpha << std::endl; logFile << "Doing USM using gauss width of " << gauss_width << " and alpha of " << alpha << std::endl;
renewLogging(); renewLogging();
updateImageDisplay(); updateImageDisplay();
} }
/**************************************************************************************** /****************************************************************************************