]> granicus.if.org Git - imagemagick/commitdiff
Fixed off by one bug in AdaptiveThresholdImage.
authordirk <dirk@git.imagemagick.org>
Tue, 6 Jan 2015 22:24:27 +0000 (22:24 +0000)
committerdirk <dirk@git.imagemagick.org>
Tue, 6 Jan 2015 22:24:27 +0000 (22:24 +0000)
MagickCore/threshold.c

index 7a8b6f3954306e2fa03339f747e8f1c78a057806..788e33ee60e7bc9d7e3dc1b044588794b78d4adc 100644 (file)
@@ -321,7 +321,7 @@ MagickExport Image *AdaptiveThresholdImage(const Image *image,
           channel_bias[channel]+=pixels[i];
           pixels+=(width-1)*GetPixelChannels(image);
           channel_sum[channel]+=pixels[i];
-          pixels+=GetPixelChannels(image)*image->columns;
+          pixels+=GetPixelChannels(image)*(image->columns+1);
         }
         mean=(double) (channel_sum[channel]/number_pixels+bias);
         SetPixelChannel(threshold_image,channel,(Quantum) ((double)