I would like to know that which kind of edge algorithms (-edge function) in ImageMajick
If anyone know, Plz suggest me in urgent.
Thanks
Which kind of edge function algorithm
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Which kind of edge function algorithm
I believe it is a convolution that is equivalent to subtracting a gaussian blur from the original image.
Code: Select all
MagickExport Image *EdgeImage(const Image *image,const double radius,
ExceptionInfo *exception)
{
Image
*edge_image;
double
*kernel;
register long
i;
unsigned long
width;
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
width=GetOptimalKernelWidth1D(radius,0.5);
kernel=(double *) AcquireQuantumMemory((size_t) width,width*sizeof(*kernel));
if (kernel == (double *) NULL)
ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
for (i=0; i < (long) (width*width); i++)
kernel[i]=(-1.0);
kernel[i/2]=(double) (width*width-1.0);
edge_image=ConvolveImage(image,width,kernel,exception);
kernel=(double *) RelinquishMagickMemory(kernel);
return(edge_image);
}
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Which kind of edge function algorithm
You can alos use -morphology EdgeIn Diamond
See http://www.imagemagick.org/Usage/morphology/#edge-in
See http://www.imagemagick.org/Usage/morphology/#edge-in
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Which kind of edge function algorithm
other edge functions are in my scripts, laplacian, gradient and derivative and dog. see link below