From: Cristy Date: Sat, 2 Jul 2016 21:29:32 +0000 (-0400) Subject: Patch so -kuwahara option can preserve colormapped edges X-Git-Tag: 7.0.2-3~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f90b5ceb41b5ce5188eebcba461070056c2fe962;p=imagemagick Patch so -kuwahara option can preserve colormapped edges --- diff --git a/MagickCore/effect.c b/MagickCore/effect.c index e18879ba5..7502b96af 100644 --- a/MagickCore/effect.c +++ b/MagickCore/effect.c @@ -1501,7 +1501,7 @@ MagickExport Image *KuwaharaImage(const Image *image,const double radius, #pragma omp parallel for schedule(static,4) shared(progress,status) \ magick_threads(image,kuwahara_image,image->rows,1) #endif - for (y=0; y < (ssize_t) image->rows; y++) + for (y=0; y < (ssize_t) gaussian_image->rows; y++) { register Quantum *magick_restrict q; @@ -1518,7 +1518,7 @@ MagickExport Image *KuwaharaImage(const Image *image,const double radius, status=MagickFalse; continue; } - for (x=0; x < (ssize_t) image->columns; x++) + for (x=0; x < (ssize_t) gaussian_image->columns; x++) { const Quantum *magick_restrict p; @@ -1587,7 +1587,7 @@ MagickExport Image *KuwaharaImage(const Image *image,const double radius, { for (j=0; j < (ssize_t) GetPixelChannels(gaussian_image); j++) mean[j]+=(double) k[j]; - k+=GetPixelChannels(image); + k+=GetPixelChannels(gaussian_image); } for (j=0; j < (ssize_t) GetPixelChannels(gaussian_image); j++) mean[j]/=(double) (width*width); @@ -1601,7 +1601,7 @@ MagickExport Image *KuwaharaImage(const Image *image,const double radius, luma=GetPixelLuma(gaussian_image,k); variance+=(luma-GetMeanLuma(gaussian_image,mean))* (luma-GetMeanLuma(gaussian_image,mean)); - k+=GetPixelChannels(image); + k+=GetPixelChannels(gaussian_image); } if (variance < min_variance) {