From: anthony Date: Sun, 23 May 2010 23:08:57 +0000 (+0000) Subject: Added Rotation Expansion for single Built-in kernels (globally) X-Git-Tag: 7.0.1-0~9409 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f0176c3994ec4f0eed7a5e0078e4bd7a012194c4;p=imagemagick Added Rotation Expansion for single Built-in kernels (globally) --- diff --git a/ChangeLog b/ChangeLog index 4bc018b04..ea593f21d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,7 +7,10 @@ while HitAndMiss defaults to "Lighten" (union of all kernel results). Other morphology methods defaults still to be decided. * Added HitAndMiss Kernel: Ridges (find ridges and pixel width lines) + * Rotation Expansion of single kernels '^' and '@' flags in arguments + EG: -set option:showkernel 1 -morphology Convolve 'Blur:0x2^' * ExpandKernelInfo() (rotation expand) now groks symmetrical kernels. + So the above will only produce a list of 2 kernels, not 4 kernels 2010-05-18 6.6.2.0 Anthony Thyssen * Separation of internal function MorphologyAppy() from @@ -15,7 +18,8 @@ * Rewrite of MorphologyApply() to output better 'verbose' messages * Better handling of Gaussian tyle filters (bug fixes) * Bug fix and optimization of kernel size calculations in "gem.c" - * Allow kernel rotation flags in 'user defined' kernels + * Allow '^' or '@' flags in 'user defined' kernel size arguments to + expand kernel into a rotated list. EG: -set option:showkernel 1 -morphology Thinning '3@: 0,1,0 0,1,0 0,0,0' * Allow a scaled unity kernel to be added to kernel (EdgeDet->Sharpen) EG: -set option:convolve:scale [kernel_scale][^!],[unity_scale][%] diff --git a/magick/morphology.c b/magick/morphology.c index a1b7f8064..4df42c2f7 100644 --- a/magick/morphology.c +++ b/magick/morphology.c @@ -364,6 +364,9 @@ static KernelInfo *ParseKernelArray(const char *kernel_string) static KernelInfo *ParseKernelName(const char *kernel_string) { + KernelInfo + *kernel; + char token[MaxTextExtent]; @@ -447,7 +450,17 @@ static KernelInfo *ParseKernelName(const char *kernel_string) break; } - return(AcquireKernelBuiltIn((KernelInfoType)type, &args)); + kernel = AcquireKernelBuiltIn((KernelInfoType)type, &args); + + /* global expand to rotated kernel list - only for single kernels */ + if ( kernel->next == (KernelInfo *) NULL ) { + if ( (flags & AreaValue) != 0 ) /* '@' symbol in kernel args */ + ExpandKernelInfo(kernel, 45.0); + else if ( (flags & MinimumValue) != 0 ) /* '^' symbol in kernel args */ + ExpandKernelInfo(kernel, 90.0); + } + + return(kernel); } MagickExport KernelInfo *AcquireKernelInfo(const char *kernel_string)