Page 1 of 1
Which kind of edge function algorithm
Posted: 2010-05-02T21:16:34-07:00
by cherry
I would like to know that which kind of edge algorithms (-edge function) in ImageMajick
If anyone know, Plz suggest me in urgent.
Thanks
Re: Which kind of edge function algorithm
Posted: 2010-05-02T21:25:46-07:00
by fmw42
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);
}
Re: Which kind of edge function algorithm
Posted: 2010-05-04T19:24:15-07:00
by anthony
Re: Which kind of edge function algorithm
Posted: 2010-05-04T19:40:32-07:00
by fmw42
other edge functions are in my scripts, laplacian, gradient and derivative and dog. see link below