fix -ve lobes on laplacian for large sigma

This commit is contained in:
John Cupitt 2011-05-30 12:14:20 +01:00
parent fc363fae99
commit a55e8d15bb
2 changed files with 7 additions and 9 deletions

View File

@ -62,6 +62,7 @@
- new API is now functional
- vips.c generates GOption flags for vips8 operations
- added im_gauss_dmask_sep()
- laplacian generator lost -ve lobes for large sigma
30/11/10 started 7.24.0
- bump for new stable

View File

@ -105,14 +105,11 @@ im_log_dmask( const char *filename, double sigma, double min_ampl )
DOUBLEMASK *m;
double sum;
/* Stop used-before-set warnings.
*/
last = 0.0;
/* Find the size of the mask depending on the entered data. We want to
* eval the mask out to the flat zero part, ie. beyond the minimum and
* to the point where it comes back up towards zero.
*/
last = 0.0;
for( x = 0; x < IM_MAXMASK; x++ ) {
const double distance = x * x;
double val;
@ -129,12 +126,12 @@ im_log_dmask( const char *filename, double sigma, double min_ampl )
(2.0 - (distance / sig2)) *
exp( -distance / (2.0 * sig2) );
/* Stop when change in temp (ie. difference from the last
* point) and absolute value are both less than the min.
/* Stop when change in value (ie. difference from the last
* point) is positive (ie. we are going up) and absolute value
* is less than the min.
*/
if( x > 0 &&
fabs( val ) < min_ampl &&
fabs( val - last ) < min_ampl )
if( val - last >= 0 &&
fabs( val ) < min_ampl )
break;
last = val;