}
// Hilight edges in image
-void Magick::Image::edge ( const double radius_, const double sigma_ )
+void Magick::Image::edge ( const double radius_ )
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- EdgeImage( image(), radius_, sigma_, &exceptionInfo );
+ EdgeImage( image(), radius_, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
void draw ( const std::list<Magick::Drawable> &drawable_ );
// Edge image (hilight edges in image)
- void edge ( const double radius_ = 0.0,
- const double sigma_ = 1.0);
+ void edge ( const double radius_ = 0.0 )
// Emboss image (hilight edges with 3D effect)
// The radius_ parameter specifies the radius of the Gaussian, in
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(radius,&geometry_info);
- edge_image=EdgeImage(*image,geometry_info.rho,geometry_info.sigma,
- exception);
+ edge_image=EdgeImage(*image,geometry_info.rho,exception);
if (edge_image != (Image *) NULL)
{
*image=DestroyImage(*image);
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(amount,&geometry_info);
- spread_image=EdgeImage(*image,geometry_info.rho,geometry_info.sigma,
- exception);
+ spread_image=EdgeImage(*image,geometry_info.rho,exception);
if (spread_image != (Image *) NULL)
{
*image=DestroyImage(*image);
/*
Edge detect the image brighness channel, level, blur, and level again.
*/
- edge_image=EdgeImage(image,radius,sigma,exception);
+ edge_image=EdgeImage(image,radius,exception);
if (edge_image == (Image *) NULL)
{
blur_image=DestroyImage(blur_image);
/*
Edge detect the image brighness channel, level, sharp, and level again.
*/
- edge_image=EdgeImage(image,radius,sigma,exception);
+ edge_image=EdgeImage(image,radius,exception);
if (edge_image == (Image *) NULL)
{
sharp_image=DestroyImage(sharp_image);
% The format of the EdgeImage method is:
%
% Image *EdgeImage(const Image *image,const double radius,
-% const double sigma,ExceptionInfo *exception)
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o radius: the radius of the pixel neighborhood.
%
-% o sigma: the standard deviation of the Gaussian, in pixels.
-%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport Image *EdgeImage(const Image *image,const double radius,
- const double sigma,ExceptionInfo *exception)
+ ExceptionInfo *exception)
{
- Image
- *edge_image;
+ char
+ geometry[MaxTextExtent];
KernelInfo
*kernel_info;
- register ssize_t
- i;
-
- size_t
- width;
-
- ssize_t
- j,
- u,
- v;
+ Image
+ *edge_image;
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
- width=GetOptimalKernelWidth1D(radius,sigma);
- kernel_info=AcquireKernelInfo((const char *) NULL);
+ (void) FormatLocaleString(geometry,MaxTextExtent,"laplacian:%.20g",radius);
+ kernel_info=AcquireKernelInfo(geometry);
if (kernel_info == (KernelInfo *) NULL)
ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
- kernel_info->width=width;
- kernel_info->height=width;
- kernel_info->x=(ssize_t) (width-1)/2;
- kernel_info->y=(ssize_t) (width-1)/2;
- kernel_info->values=(MagickRealType *) MagickAssumeAligned(
- AcquireAlignedMemory(kernel_info->width,kernel_info->width*
- sizeof(*kernel_info->values)));
- if (kernel_info->values == (MagickRealType *) NULL)
- {
- kernel_info=DestroyKernelInfo(kernel_info);
- ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
- }
- j=(ssize_t) (kernel_info->width-1)/2;
- i=0;
- for (v=(-j); v <= j; v++)
- {
- for (u=(-j); u <= j; u++)
- {
- kernel_info->values[i]=(MagickRealType) (-1.0);
- i++;
- }
- }
- kernel_info->values[(i-1)/2]=(MagickRealType) (width*width-1.0);
- edge_image=ConvolveImage(image,kernel_info,exception);
+ edge_image=MorphologyImage(image,ConvolveMorphology,1,kernel_info,exception);
kernel_info=DestroyKernelInfo(kernel_info);
return(edge_image);
}
}
case EdgeDetectPreview:
{
- preview_image=EdgeImage(thumbnail,radius,sigma,exception);
+ preview_image=EdgeImage(thumbnail,radius,exception);
(void) FormatLocaleString(label,MaxTextExtent,"edge %g",radius);
break;
}
*kernel_info;
Image
- *sharpen_image;
+ *sharp_image;
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
if (kernel_info == (KernelInfo *) NULL)
ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
ScaleGeometryKernelInfo(kernel_info,"56!,100%");
- sharpen_image=MorphologyImage(image,ConvolveMorphology,1,kernel_info,
+ sharp_image=MorphologyImage(image,ConvolveMorphology,1,kernel_info,
exception);
kernel_info=DestroyKernelInfo(kernel_info);
- return(sharpen_image);
+ return(sharp_image);
}
\f
/*
*BlurImage(const Image *,const double,const double,ExceptionInfo *),
*ConvolveImage(const Image *,const KernelInfo *,ExceptionInfo *),
*DespeckleImage(const Image *,ExceptionInfo *),
- *EdgeImage(const Image *,const double,const double,ExceptionInfo *),
+ *EdgeImage(const Image *,const double,ExceptionInfo *),
*EmbossImage(const Image *,const double,const double,ExceptionInfo *),
*GaussianBlurImage(const Image *,const double,const double,ExceptionInfo *),
*MotionBlurImage(const Image *,const double,const double,const double,
if (clone_image == (Image *) NULL)
return((Image *) NULL);
(void) SetImageType(clone_image,GrayscaleType,exception);
- edge_image=EdgeImage(clone_image,radius,sigma,exception);
+ edge_image=EdgeImage(clone_image,radius,exception);
clone_image=DestroyImage(clone_image);
if (edge_image == (Image *) NULL)
return((Image *) NULL);
random_image=DestroyImage(random_image);
if (blur_image == (Image *) NULL)
return((Image *) NULL);
- dodge_image=EdgeImage(blur_image,radius,1.0,exception);
+ dodge_image=EdgeImage(blur_image,radius,exception);
blur_image=DestroyImage(blur_image);
if (dodge_image == (Image *) NULL)
return((Image *) NULL);
%
% The format of the MagickEdgeImage method is:
%
-% MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
-% const double sigma)
+% MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
%
% A description of each parameter follows:
%
%
% o radius: the radius of the pixel neighborhood.
%
-% o sigma: the standard deviation of the Gaussian, in pixels.
-%
*/
WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
- const double radius,const double sigma)
+ const double radius)
{
Image
*edge_image;
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- edge_image=EdgeImage(wand->images,radius,sigma,wand->exception);
+ edge_image=EdgeImage(wand->images,radius,wand->exception);
if (edge_image == (Image *) NULL)
return(MagickFalse);
ReplaceImageInList(&wand->images,edge_image);
MagickDistortImage(MagickWand *,const DistortImageMethod,const size_t,
const double *,const MagickBooleanType),
MagickDrawImage(MagickWand *,const DrawingWand *),
- MagickEdgeImage(MagickWand *,const double,const double),
+ MagickEdgeImage(MagickWand *,const double),
MagickEmbossImage(MagickWand *,const double,const double),
MagickEncipherImage(MagickWand *,const char *),
MagickEnhanceImage(MagickWand *),
*/
(void) SyncImageSettings(mogrify_info,*image,exception);
flags=ParseGeometry(argv[i+1],&geometry_info);
- if ((flags & SigmaValue) == 0)
- geometry_info.sigma=1.0;
- mogrify_image=EdgeImage(*image,geometry_info.rho,
- geometry_info.sigma,exception);
+ mogrify_image=EdgeImage(*image,geometry_info.rho,exception);
break;
}
if (LocaleCompare("emboss",option+1) == 0)
flags=ParseGeometry(arg1,&geometry_info);
if ((flags & (RhoValue|SigmaValue)) == 0)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
- if ((flags & SigmaValue) == 0)
- geometry_info.sigma=1.0;
- new_image=EdgeImage(_image,geometry_info.rho,geometry_info.sigma,
- _exception);
+ new_image=EdgeImage(_image,geometry_info.rho,_exception);
break;
}
if (LocaleCompare("emboss",option+1) == 0)
{
if (attribute_flag[0] != 0)
geometry_info.rho=argument_list[0].real_reference;
- image=EdgeImage(image,geometry_info.rho,geometry_info.sigma,
- exception);
+ image=EdgeImage(image,geometry_info.rho,exception);
break;
}
case 11: /* Emboss */
}
}
edge_image=EdgeImage(msl_info->image[n],geometry_info.rho,
- geometry_info.sigma,msl_info->exception);
+ msl_info->exception);
if (edge_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);