Skip to content

Commit

Permalink
Aaand now it's actually correct. Sorry.
Browse files Browse the repository at this point in the history
  • Loading branch information
stegu committed Dec 23, 2014
1 parent daeb3dc commit f7de29e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void computegradient(double *img, int w, int h, double *gx, double *gy)
k = i*w + j;
if((img[k]>0.0) && (img[k]<1.0)) { // Compute gradient for edge pixels only
gx[k] = -img[k-w-1] - SQRT2*img[k-1] - img[k+w-1] + img[k-w+1] + SQRT2*img[k+1] + img[k+w+1];
gy[k] = -img[k-w-1] - SQRT2*img[k-w] - img[k-w-1] + img[k+w+1] + SQRT2*img[k+w] + img[k+w+1];
gy[k] = -img[k-w-1] - SQRT2*img[k-w] - img[k-w+1] + img[k+w-1] + SQRT2*img[k+w] + img[k+w+1];
glength = gx[k]*gx[k] + gy[k]*gy[k];
if(glength > 0.0) { // Avoid division by zero
glength = sqrt(glength);
Expand Down

0 comments on commit f7de29e

Please sign in to comment.