-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a bug (width and height were swapped)
- Loading branch information
Showing
1 changed file
with
6 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
|
@@ -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; | ||
|
@@ -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; | ||
|