% The format of the AdaptiveBlurImage method is:
%
% Image *AdaptiveBlurImage(const Image *image,const double radius,
-% const double sigma,const double bias,ExceptionInfo *exception)
+% const double sigma,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o sigma: the standard deviation of the Laplacian, in pixels.
%
-% o bias: the bias.
-%
% o exception: return any errors or warnings in this structure.
%
*/
}
MagickExport Image *AdaptiveBlurImage(const Image *image,const double radius,
- const double sigma,const double bias,ExceptionInfo *exception)
+ const double sigma,ExceptionInfo *exception)
{
#define AdaptiveBlurImageTag "Convolve/Image"
#define MagickSigma (fabs(sigma) <= MagickEpsilon ? 1.0 : sigma)
*/
status=MagickTrue;
progress=0;
- image_view=AcquireCacheView(image);
- edge_view=AcquireCacheView(edge_image);
- blur_view=AcquireCacheView(blur_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ edge_view=AcquireVirtualCacheView(edge_image,exception);
+ blur_view=AcquireAuthenticCacheView(blur_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status)
#endif
break;
center=(ssize_t) GetPixelChannels(image)*(width-j)*((width-j)/2L)+
GetPixelChannels(image)*((width-j)/2L);
+ if (GetPixelMask(image,p) != 0)
+ {
+ q+=GetPixelChannels(blur_image);
+ r+=GetPixelChannels(edge_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
MagickRealType
if ((traits == UndefinedPixelTrait) ||
(blur_traits == UndefinedPixelTrait))
continue;
- if (((blur_traits & CopyPixelTrait) != 0) ||
- (GetPixelMask(image,q) != 0))
+ if ((blur_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(blur_image,channel,p[center+i],q);
continue;
}
k=kernel[j];
pixels=p;
- pixel=bias;
+ pixel=0.0;
gamma=0.0;
if ((blur_traits & BlendPixelTrait) == 0)
{
% The format of the AdaptiveSharpenImage method is:
%
% Image *AdaptiveSharpenImage(const Image *image,const double radius,
-% const double sigma,const double bias,ExceptionInfo *exception)
+% const double sigma,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o sigma: the standard deviation of the Laplacian, in pixels.
%
-% o bias: the bias.
-%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport Image *AdaptiveSharpenImage(const Image *image,const double radius,
- const double sigma,const double bias,ExceptionInfo *exception)
+ const double sigma,ExceptionInfo *exception)
{
#define AdaptiveSharpenImageTag "Convolve/Image"
#define MagickSigma (fabs(sigma) <= MagickEpsilon ? 1.0 : sigma)
*/
status=MagickTrue;
progress=0;
- image_view=AcquireCacheView(image);
- edge_view=AcquireCacheView(edge_image);
- sharp_view=AcquireCacheView(sharp_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ edge_view=AcquireVirtualCacheView(edge_image,exception);
+ sharp_view=AcquireAuthenticCacheView(sharp_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status)
#endif
break;
center=(ssize_t) GetPixelChannels(image)*(width-j)*((width-j)/2L)+
GetPixelChannels(image)*((width-j)/2);
+ if (GetPixelMask(image,p) != 0)
+ {
+ q+=GetPixelChannels(sharp_image);
+ r+=GetPixelChannels(edge_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(sharp_image); i++)
{
MagickRealType
if ((traits == UndefinedPixelTrait) ||
(sharp_traits == UndefinedPixelTrait))
continue;
- if (((sharp_traits & CopyPixelTrait) != 0) ||
- (GetPixelMask(image,q) != 0))
+ if ((sharp_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(sharp_image,channel,p[center+i],q);
continue;
}
k=kernel[j];
pixels=p;
- pixel=bias;
+ pixel=0.0;
gamma=0.0;
if ((sharp_traits & BlendPixelTrait) == 0)
{
% The format of the BlurImage method is:
%
% Image *BlurImage(const Image *image,const double radius,
-% const double sigma,const double bias,ExceptionInfo *exception)
+% const double sigma,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o sigma: the standard deviation of the Gaussian, in pixels.
%
-% o bias: the bias.
-%
% o exception: return any errors or warnings in this structure.
%
*/
}
MagickExport Image *BlurImage(const Image *image,const double radius,
- const double sigma,const double bias,ExceptionInfo *exception)
+ const double sigma,ExceptionInfo *exception)
{
#define BlurImageTag "Blur/Image"
status=MagickTrue;
progress=0;
center=(ssize_t) GetPixelChannels(image)*(width/2L);
- image_view=AcquireCacheView(image);
- blur_view=AcquireCacheView(blur_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ blur_view=AcquireAuthenticCacheView(blur_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status)
#endif
register ssize_t
i;
+ if (GetPixelMask(image,p) != 0)
+ {
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(blur_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
MagickRealType
if ((traits == UndefinedPixelTrait) ||
(blur_traits == UndefinedPixelTrait))
continue;
- if (((blur_traits & CopyPixelTrait) != 0) ||
- (GetPixelMask(image,p) != 0))
+ if ((blur_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(blur_image,channel,p[center+i],q);
continue;
Blur columns.
*/
center=(ssize_t) GetPixelChannels(blur_image)*(width/2L);
- image_view=AcquireCacheView(blur_image);
- blur_view=AcquireCacheView(blur_image);
+ image_view=AcquireVirtualCacheView(blur_image,exception);
+ blur_view=AcquireAuthenticCacheView(blur_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status)
#endif
register ssize_t
i;
+ if (GetPixelMask(image,p) != 0)
+ {
+ p+=GetPixelChannels(blur_image);
+ q+=GetPixelChannels(blur_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(blur_image); i++)
{
MagickRealType
if ((traits == UndefinedPixelTrait) ||
(blur_traits == UndefinedPixelTrait))
continue;
- if (((blur_traits & CopyPixelTrait) != 0) ||
- (GetPixelMask(blur_image,p) != 0))
+ if ((blur_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(blur_image,channel,p[center+i],q);
continue;
Reduce speckle in the image.
*/
status=MagickTrue;
- image_view=AcquireCacheView(image);
- despeckle_view=AcquireCacheView(despeckle_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ despeckle_view=AcquireAuthenticCacheView(despeckle_image,exception);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
}
}
kernel_info->values[i/2]=(double) (width*width-1.0);
- kernel_info->bias=image->bias; /* FUTURE: User bias on a edge image? */
edge_image=ConvolveImage(image,kernel_info,exception);
kernel_info=DestroyKernelInfo(kernel_info);
return(edge_image);
}
k--;
}
- kernel_info->bias=image->bias; /* FUTURE: user bias on an edge image */
emboss_image=ConvolveImage(image,kernel_info,exception);
kernel_info=DestroyKernelInfo(kernel_info);
if (emboss_image != (Image *) NULL)
% The format of the MotionBlurImage method is:
%
% Image *MotionBlurImage(const Image *image,const double radius,
-% const double sigma,const double angle,const double bias,
-% ExceptionInfo *exception)
+% const double sigma,const double angle,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o angle: Apply the effect along this angle.
%
-% o bias: the bias.
-%
% o exception: return any errors or warnings in this structure.
%
*/
}
MagickExport Image *MotionBlurImage(const Image *image,const double radius,
- const double sigma,const double angle,const double bias,
- ExceptionInfo *exception)
+ const double sigma,const double angle,ExceptionInfo *exception)
{
CacheView
*blur_view,
*/
status=MagickTrue;
progress=0;
- image_view=AcquireCacheView(image);
- motion_view=AcquireCacheView(image);
- blur_view=AcquireCacheView(blur_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ motion_view=AcquireVirtualCacheView(image,exception);
+ blur_view=AcquireAuthenticCacheView(blur_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status)
#endif
register ssize_t
i;
+ if (GetPixelMask(image,p) != 0)
+ {
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(blur_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
MagickRealType
if ((traits == UndefinedPixelTrait) ||
(blur_traits == UndefinedPixelTrait))
continue;
- if (((blur_traits & CopyPixelTrait) != 0) ||
- (GetPixelMask(image,p) != 0))
+ if ((blur_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(blur_image,channel,p[i],q);
continue;
}
k=kernel;
- pixel=bias;
+ pixel=0.0;
if ((blur_traits & BlendPixelTrait) == 0)
{
for (j=0; j < (ssize_t) width; j++)
}
case SharpenPreview:
{
- /* FUTURE: user bias on sharpen! This is non-sensical! */
- preview_image=SharpenImage(thumbnail,radius,sigma,image->bias,
- exception);
+ preview_image=SharpenImage(thumbnail,radius,sigma,exception);
(void) FormatLocaleString(label,MaxTextExtent,"sharpen %gx%g",
radius,sigma);
break;
}
case BlurPreview:
{
- /* FUTURE: user bias on blur! This is non-sensical! */
- preview_image=BlurImage(thumbnail,radius,sigma,image->bias,exception);
+ preview_image=BlurImage(thumbnail,radius,sigma,exception);
(void) FormatLocaleString(label,MaxTextExtent,"blur %gx%g",radius,
sigma);
break;
if (preview_image == (Image *) NULL)
break;
threshold+=0.4f;
- (void) SegmentImage(preview_image,RGBColorspace,MagickFalse,threshold,
+ (void) SegmentImage(preview_image,sRGBColorspace,MagickFalse,threshold,
threshold,exception);
(void) FormatLocaleString(label,MaxTextExtent,"segment %gx%g",
threshold,threshold);
}
case CharcoalDrawingPreview:
{
- /* FUTURE: user bias on charcoal! This is non-sensical! */
preview_image=CharcoalImage(thumbnail,(double) radius,(double) sigma,
- image->bias,exception);
+ exception);
(void) FormatLocaleString(label,MaxTextExtent,"charcoal %gx%g",
radius,sigma);
break;
% The format of the RadialBlurImage method is:
%
% Image *RadialBlurImage(const Image *image,const double angle,
-% const double blur,ExceptionInfo *exception)
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
*/
MagickExport Image *RadialBlurImage(const Image *image,const double angle,
- const double bias,ExceptionInfo *exception)
+ ExceptionInfo *exception)
{
CacheView
*blur_view,
*/
status=MagickTrue;
progress=0;
- image_view=AcquireCacheView(image);
- radial_view=AcquireCacheView(image);
- blur_view=AcquireCacheView(blur_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ radial_view=AcquireVirtualCacheView(image,exception);
+ blur_view=AcquireAuthenticCacheView(blur_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status)
#endif
if (step >= n)
step=n-1;
}
+ if (GetPixelMask(image,p) != 0)
+ {
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(blur_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
MagickRealType
if ((traits == UndefinedPixelTrait) ||
(blur_traits == UndefinedPixelTrait))
continue;
- if (((blur_traits & CopyPixelTrait) != 0) ||
- (GetPixelMask(image,p) != 0))
+ if ((blur_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(blur_image,channel,p[i],q);
continue;
}
gamma=0.0;
- pixel=bias;
+ pixel=0.0;
if ((blur_traits & BlendPixelTrait) == 0)
{
for (j=0; j < (ssize_t) n; j+=(ssize_t) step)
% The format of the SelectiveBlurImage method is:
%
% Image *SelectiveBlurImage(const Image *image,const double radius,
-% const double sigma,const double threshold,const double bias,
-% ExceptionInfo *exception)
+% const double sigma,const double threshold,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o threshold: only pixels within this contrast threshold are included
% in the blur operation.
%
-% o bias: the bias.
-%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport Image *SelectiveBlurImage(const Image *image,const double radius,
- const double sigma,const double threshold,const double bias,
- ExceptionInfo *exception)
+ const double sigma,const double threshold,ExceptionInfo *exception)
{
#define SelectiveBlurImageTag "SelectiveBlur/Image"
progress=0;
center=(ssize_t) (GetPixelChannels(image)*(image->columns+width)*(width/2L)+
GetPixelChannels(image)*(width/2L));
- image_view=AcquireCacheView(image);
- blur_view=AcquireCacheView(blur_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ blur_view=AcquireAuthenticCacheView(blur_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status)
#endif
register ssize_t
i;
+ if (GetPixelMask(image,p) != 0)
+ {
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(blur_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
MagickRealType
if ((traits == UndefinedPixelTrait) ||
(blur_traits == UndefinedPixelTrait))
continue;
- if (((blur_traits & CopyPixelTrait) != 0) ||
- (GetPixelMask(image,p) != 0))
+ if ((blur_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(blur_image,channel,p[center+i],q);
continue;
}
k=kernel;
- pixel=bias;
+ pixel=0.0;
pixels=p;
intensity=(MagickRealType) GetPixelIntensity(image,p+center);
gamma=0.0;
*/
status=MagickTrue;
progress=0;
- image_view=AcquireCacheView(image);
- shade_view=AcquireCacheView(shade_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ shade_view=AcquireAuthenticCacheView(shade_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status)
#endif
shade=distance/sqrt((double) normal_distance);
}
}
+ if (GetPixelMask(image,p) != 0)
+ {
+ pre+=GetPixelChannels(image);
+ center+=GetPixelChannels(image);
+ post+=GetPixelChannels(image);
+ q+=GetPixelChannels(shade_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
if ((traits == UndefinedPixelTrait) ||
(shade_traits == UndefinedPixelTrait))
continue;
- if (((shade_traits & CopyPixelTrait) != 0) ||
- (GetPixelMask(image,pre) != 0))
+ if ((shade_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(shade_image,channel,center[i],q);
continue;
% The format of the SharpenImage method is:
%
% Image *SharpenImage(const Image *image,const double radius,
-% const double sigma,const double bias,ExceptionInfo *exception)
+% const double sigma,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o sigma: the standard deviation of the Laplacian, in pixels.
%
-% o bias: bias.
-%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport Image *SharpenImage(const Image *image,const double radius,
- const double sigma,const double bias,ExceptionInfo *exception)
+ const double sigma,ExceptionInfo *exception)
{
double
normalize;
(void) ResetMagickMemory(kernel_info,0,sizeof(*kernel_info));
kernel_info->width=width;
kernel_info->height=width;
- kernel_info->bias=bias; /* FUTURE: user bias - non-sensical! */
kernel_info->signature=MagickSignature;
kernel_info->values=(MagickRealType *) AcquireAlignedMemory(
kernel_info->width,kernel_info->width*sizeof(*kernel_info->values));
*spread_image;
MagickBooleanType
+ concurrent,
status;
MagickOffsetType
progress=0;
width=GetOptimalKernelWidth1D(radius,0.5);
random_info=AcquireRandomInfoThreadSet();
- image_view=AcquireCacheView(image);
- spread_view=AcquireCacheView(spread_image);
+ concurrent=GetRandomSecretKey(random_info[0]) == ~0UL ? MagickTrue :
+ MagickFalse;
+ image_view=AcquireVirtualCacheView(image,exception);
+ spread_view=AcquireAuthenticCacheView(spread_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,8) shared(progress,status)
+ #pragma omp parallel for schedule(static,8) shared(progress,status) omp_concurrent(concurrent)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
- unsharp_image=BlurImage(image,radius,sigma,image->bias,exception);
+ unsharp_image=BlurImage(image,radius,sigma,exception);
if (unsharp_image == (Image *) NULL)
return((Image *) NULL);
quantum_threshold=(MagickRealType) QuantumRange*threshold;
*/
status=MagickTrue;
progress=0;
- image_view=AcquireCacheView(image);
- unsharp_view=AcquireCacheView(unsharp_image);
+ image_view=AcquireVirtualCacheView(image,exception);
+ unsharp_view=AcquireAuthenticCacheView(unsharp_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status)
#endif
register ssize_t
i;
+ if (GetPixelMask(image,p) != 0)
+ {
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(unsharp_image);
+ continue;
+ }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
MagickRealType
if ((traits == UndefinedPixelTrait) ||
(unsharp_traits == UndefinedPixelTrait))
continue;
- if (((unsharp_traits & CopyPixelTrait) != 0) ||
- (GetPixelMask(image,p) != 0))
+ if ((unsharp_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(unsharp_image,channel,p[i],q);
continue;