Skip to content

Commit

Permalink
Fixed a bug (width and height were swapped)
Browse files Browse the repository at this point in the history
  • Loading branch information
stegu committed Jan 6, 2015
1 parent f7de29e commit 84d0c0b
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* ([email protected]), edited by Stefan
* Gustavson ([email protected]) to output
* 16-bit distance data for better range and accuracy.
*
* Updated 2015-01-06 to fix a bug (height/width were swapped)
*/

#include <stdlib.h>
Expand Down Expand Up @@ -178,8 +180,8 @@ make_distance_map( unsigned char *img, unsigned int width, unsigned int height )
}

// Transform background (outside contour, in areas of 0's)
computegradient( data, height, width, gx, gy);
edtaa3(data, gx, gy, height, width, xdist, ydist, outside);
computegradient( data, width, height, gx, gy);
edtaa3(data, gx, gy, width, height, xdist, ydist, outside);
for( i=0; i<width*height; i++)
if( outside[i] < 0.0 )
outside[i] = 0.0;
Expand All @@ -189,8 +191,8 @@ make_distance_map( unsigned char *img, unsigned int width, unsigned int height )
memset(gy, 0, sizeof(double)*width*height );
for( i=0; i<width*height; i++)
data[i] = 1 - data[i];
computegradient( data, height, width, gx, gy);
edtaa3(data, gx, gy, height, width, xdist, ydist, inside);
computegradient( data, width, height, gx, gy);
edtaa3(data, gx, gy, width, height, xdist, ydist, inside);
for( i=0; i<width*height; i++)
if( inside[i] < 0.0 )
inside[i] = 0.0;
Expand Down

0 comments on commit 84d0c0b

Please sign in to comment.