[TASK] Fix up the gauss filter weights.
This commit is contained in:
parent
000a2be162
commit
09c9390f42
@ -72,8 +72,13 @@ class CannyEdgeMachine {
|
||||
// build the gauss filter
|
||||
int* filter = (int*) malloc(sizeof(int) * filter_width* filter_width);
|
||||
int sum_weights = 0;
|
||||
for(int i=0; i<filter_width; i++) {
|
||||
for(int j=0; j<filter_width; j++) {
|
||||
int filter_middle = (filter_width)/2;
|
||||
for(int x=0; x<filter_width; x++) {
|
||||
int i = x;
|
||||
if(x > filter_middle) i = filter_middle - (x - filter_middle);
|
||||
for(int y=0; y<filter_width; y++) {
|
||||
int j = y;
|
||||
if(y > filter_middle) j = filter_middle - (y - filter_middle);
|
||||
filter[i*filter_width + j] = pow(2, i) * pow(2, j);
|
||||
sum_weights += filter[i*filter_width + j];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user