}
// Hilight edges in image
-void Magick::Image::edge ( const double radius_ )
+void Magick::Image::edge ( const double radius_)
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- EdgeImage( image(), radius_, &exceptionInfo );
+ EdgeImage( image(), radius_, 1.0, &exceptionInfo );
+ replaceImage( newImage );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
+}
+void Magick::Image::edge ( const double radius_, const double sigma_ )
+{
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ MagickCore::Image* newImage =
+ EdgeImage( image(), radius_, sigma_, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
// Edge image (hilight edges in image)
void edge ( const double radius_ = 0.0 );
+ void edge ( const double radius_ = 0.0,
+ const double sigma_ = 1.0);
// Emboss image (hilight edges with 3D effect)
// The radius_ parameter specifies the radius of the Gaussian, in
class MagickDLLDecl edgeImage : public std::unary_function<Image&,void>
{
public:
- edgeImage( const double radius_ = 0.0 );
+ edgeImage( const double radius_ = 0.0, const double sigma_ = 0.5 );
void operator()( Image &image_ ) const;
private:
double _radius;
+ double _sigma;
};
// Emboss image (hilight edges with 3D effect)
}
// Edge image (hilight edges in image)
-Magick::edgeImage::edgeImage( const double radius_ )
- : _radius( radius_ )
+Magick::edgeImage::edgeImage( const double radius_, const double sigma_ )
+ : _radius( radius_ ),
+ _sigma( sigma_ )
{
}
void Magick::edgeImage::operator()( Magick::Image &image_ ) const
{
- image_.edge( _radius );
+ image_.edge( _radius, _sigma );
}
// Emboss image (hilight edges with 3D effect)
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(radius,&geometry_info);
- edge_image=EdgeImage(*image,geometry_info.rho,exception);
+ edge_image=EdgeImage(*image,geometry_info.rho,geometry_info.sigma,
+ 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,exception);
+ spread_image=EdgeImage(*image,geometry_info.rho,geometry_info.sigma,
+ 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,exception);
+ edge_image=EdgeImage(image,radius,sigma,exception);
if (edge_image == (Image *) NULL)
{
blur_image=DestroyImage(blur_image);
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_AdaptiveSharpenImage)
+ #pragma omp critical (MagickCore_AdaptiveBlurImage)
#endif
proceed=SetImageProgress(image,AdaptiveBlurImageTag,progress++,
image->rows);
/*
Edge detect the image brighness channel, level, sharp, and level again.
*/
- edge_image=EdgeImage(image,radius,exception);
+ edge_image=EdgeImage(image,radius,sigma,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,
-% ExceptionInfo *exception)
+% const double sigma,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,
- ExceptionInfo *exception)
+ const double sigma,ExceptionInfo *exception)
{
Image
*edge_image;
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
- width=GetOptimalKernelWidth1D(radius,0.5);
+ width=GetOptimalKernelWidth2D(radius,sigma);
kernel_info=AcquireKernelInfo((const char *) NULL);
if (kernel_info == (KernelInfo *) NULL)
ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
}
case EdgeDetectPreview:
{
- preview_image=EdgeImage(thumbnail,radius,exception);
+ preview_image=EdgeImage(thumbnail,radius,sigma,exception);
(void) FormatLocaleString(label,MaxTextExtent,"edge %g",radius);
break;
}
*BlurImage(const Image *,const double,const double,ExceptionInfo *),
*ConvolveImage(const Image *,const KernelInfo *,ExceptionInfo *),
*DespeckleImage(const Image *,ExceptionInfo *),
- *EdgeImage(const Image *,const double,ExceptionInfo *),
+ *EdgeImage(const Image *,const double,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,exception);
+ edge_image=EdgeImage(clone_image,radius,sigma,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,exception);
+ dodge_image=EdgeImage(blur_image,radius,sigma,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)
+% MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
+% const double sigma)
%
% 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 radius,const double sigma)
{
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,wand->exception);
+ edge_image=EdgeImage(wand->images,radius,sigma,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),
+ MagickEdgeImage(MagickWand *,const double,const double),
MagickEmbossImage(MagickWand *,const double,const double),
MagickEncipherImage(MagickWand *,const char *),
MagickEnhanceImage(MagickWand *),
flags=ParseGeometry(argv[i+1],&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
- mogrify_image=EdgeImage(*image,geometry_info.rho,exception);
+ mogrify_image=EdgeImage(*image,geometry_info.rho,
+ geometry_info.sigma,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,exception);
+ image=EdgeImage(image,geometry_info.rho,geometry_info.sigma,
+ exception);
break;
}
case 11: /* Emboss */
}
}
edge_image=EdgeImage(msl_info->image[n],geometry_info.rho,
- &msl_info->image[n]->exception);
+ geometry_info.sigma,&msl_info->image[n]->exception);
if (edge_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);