136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<!DOCTYPE html>
636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<html lang="en">
736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<head>
836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy    <title>ImageMagick: MagickCore, C API for ImageMagick: Morphological Erosions, Dilations, Openings, and Closings</title>
1036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
1136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta name="application-name" content="ImageMagick"/>
1236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta name="description" content="ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves."/>
1336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta name="application-url" content="http://www.imagemagick.org"/>
1436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta name="generator" content="PHP"/>
1536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta name="keywords" content="magickcore, c, api, for, imagemagick:, morphological, erosions, dilations, openings, closings, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert"/>
1636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta name="rating" content="GENERAL"/>
1736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta name="robots" content="INDEX, FOLLOW"/>
1836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta name="generator" content="ImageMagick Studio LLC"/>
1936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta name="author" content="ImageMagick Studio LLC"/>
2036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta name="revisit-after" content="2 DAYS"/>
2136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta name="resource-type" content="document"/>
227ce65e7125a4e1df1a274ce373c537a9df9c16cdCristy  <meta name="copyright" content="Copyright (c) 1999-2016 ImageMagick Studio LLC"/>
2336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta name="distribution" content="Global"/>
2436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/>
25882d9f4ab22246b0110b960e923614ae9c53702aCristy  <link rel="icon" href="../image/wand.png"/>
26882d9f4ab22246b0110b960e923614ae9c53702aCristy  <link rel="shortcut icon" href="../image/wand.ico"/>
27882d9f4ab22246b0110b960e923614ae9c53702aCristy  <link rel="stylesheet" href="../css/magick.php"/>
2836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</head>
2936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<body>
3036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<div class="main">
3136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<div class="magick-masthead">
3236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <div class="container">
33882d9f4ab22246b0110b960e923614ae9c53702aCristy    <script async="async" src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle"
3436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy         style="display:block"
3536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy         data-ad-client="ca-pub-3129977114552745"
3636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy         data-ad-slot="6345125851"
3736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy         data-ad-format="auto"></ins>
3836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy    <script>
39882d9f4ab22246b0110b960e923614ae9c53702aCristy      (adsbygoogle = window.adsbygoogle || []).push({});
4036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy    </script>
4136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy    <nav class="magick-nav">
4236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy      <a class="magick-nav-item " href="../index.php">Home</a>
4336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy      <a class="magick-nav-item " href="../script/binary-releases.php">Download</a>
4436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy      <a class="magick-nav-item " href="../script/command-line-tools.php">Tools</a>
4536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy      <a class="magick-nav-item " href="../script/command-line-options.php">Options</a>
4636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy      <a class="magick-nav-item " href="../script/resources.php">Resources</a>
4736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy      <a class="magick-nav-item " href="../script/api.php">Develop</a>
4836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy      <a class="magick-nav-item " href="../script/search.php">Search</a>
4936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy      <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
5036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy    </nav>
5136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  </div>
5236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</div>
5336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<div class="container">
5436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<div class="magick-header">
5536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p class="text-center"><a href="morphology.php#AcquireKernelInfo">AcquireKernelInfo</a> &bull; <a href="morphology.php#AcquireKernelBuiltIn">AcquireKernelBuiltIn</a> &bull; <a href="morphology.php#CloneKernelInfo">CloneKernelInfo</a> &bull; <a href="morphology.php#DestroyKernelInfo">DestroyKernelInfo</a> &bull; <a href="morphology.php#MorphologyApply">MorphologyApply</a> &bull; <a href="morphology.php#This is almost identical to the MorphologyPrimative">This is almost identical to the MorphologyPrimative</a> &bull; <a href="morphology.php#MorphologyImage">MorphologyImage</a> &bull; <a href="morphology.php#ScaleGeometryKernelInfo">ScaleGeometryKernelInfo</a> &bull; <a href="morphology.php#ScaleKernelInfo">ScaleKernelInfo</a> &bull; <a href="morphology.php#ShowKernelInfo">ShowKernelInfo</a> &bull; <a href="morphology.php#UnityAddKernelInfo">UnityAddKernelInfo</a> &bull; <a href="morphology.php#ZeroKernelNans">ZeroKernelNans</a></p>
5636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
5736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/morphology_8c.html" id="AcquireKernelInfo">AcquireKernelInfo</a></h2>
5836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
5936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>AcquireKernelInfo() takes the given string (generally supplied by the user) and converts it into a Morphology/Convolution Kernel.  This allows users to specify a kernel from a number of pre-defined kernels, or to fully specify their own kernel for a specific Convolution or Morphology Operation.</p>
6036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
6136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The kernel so generated can be any rectangular array of floating point values (doubles) with the 'control point' or 'pixel being affected' anywhere within that array of values.</p>
6236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
6336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>Previously IM was restricted to a square of odd size using the exact center as origin, this is no longer the case, and any rectangular kernel with any value being declared the origin. This in turn allows the use of highly asymmetrical kernels.</p>
6436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
6536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The floating point values in the kernel can also include a special value known as 'nan' or 'not a number' to indicate that this value is not part of the kernel array. This allows you to shaped the kernel within its rectangular area. That is 'nan' values provide a 'mask' for the kernel shape.  However at least one non-nan value must be provided for correct working of a kernel.</p>
6636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
6736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The returned kernel should be freed using the DestroyKernelInfo() when you are finished with it.  Do not free this memory yourself.</p>
6836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
6936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>Input kernel defintion strings can consist of any of three types.</p>
7036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
7136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>"name:args[[@&gt;&lt;]" Select from one of the built in kernels, using the name and geometry arguments supplied.  See AcquireKernelBuiltIn()</p>
7236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
7336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>"WxH[+X+Y][@&gt;&lt;]:num, num, num ..." a kernel of size W by H, with W*H floating point numbers following. the 'center' can be optionally be defined at +X+Y (such that +0+0 is top left corner). If not defined the pixel in the center, for odd sizes, or to the immediate top or left of center for even sizes is automatically selected.</p>
7436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
7536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>"num, num, num, num, ..." list of floating point numbers defining an 'old style' odd sized square kernel.  At least 9 values should be provided for a 3x3 square kernel, 25 for a 5x5 square kernel, 49 for 7x7, etc. Values can be space or comma separated.  This is not recommended.</p>
7636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
7736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>You can define a 'list of kernels' which can be used by some morphology operators A list is defined as a semi-colon separated list kernels.</p>
7836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
7936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>" kernel ; kernel ; kernel ; "</p>
8036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
8136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>Any extra ';' characters, at start, end or between kernel defintions are simply ignored.</p>
8236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
8336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The special flags will expand a single kernel, into a list of rotated kernels. A '@' flag will expand a 3x3 kernel into a list of 45-degree cyclic rotations, while a '&gt;' will generate a list of 90-degree rotations. The '&lt;' also exands using 90-degree rotates, but giving a 180-degree reflected kernel before the +/- 90-degree rotations, which can be important for Thinning operations.</p>
8436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
8536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>Note that 'name' kernels will start with an alphabetic character while the new kernel specification has a ':' character in its specification string. If neither is the case, it is assumed an old style of a simple list of numbers generating a odd-sized square kernel has been given.</p>
8636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
8736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The format of the AcquireKernal method is:</p>
8836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
8936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
9036421ee45722da418b8ab99d7e6358e4f86b9f1eCristyKernelInfo *AcquireKernelInfo(const char *kernel_string)
9136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
9236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
9336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>A description of each parameter follows:</p>
9436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
9536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>
9636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dd>
9736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
9836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
9936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dl class="dl-horizontal">
10036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>kernel_string</dt>
10136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>the Morphology/Convolution kernel wanted. </dd>
10236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
10336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>  </dd>
10436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dl>
10536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/morphology_8c.html" id="AcquireKernelBuiltIn">AcquireKernelBuiltIn</a></h2>
10636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
10736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>AcquireKernelBuiltIn() returned one of the 'named' built-in types of kernels used for special purposes such as gaussian blurring, skeleton pruning, and edge distance determination.</p>
10836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
10936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>They take a KernelType, and a set of geometry style arguments, which were typically decoded from a user supplied string, or from a more complex Morphology Method that was requested.</p>
11036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
11136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The format of the AcquireKernalBuiltIn method is:</p>
11236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
11336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
11436421ee45722da418b8ab99d7e6358e4f86b9f1eCristyKernelInfo *AcquireKernelBuiltIn(const KernelInfoType type,
11536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy     const GeometryInfo args)
11636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
11736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
11836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>A description of each parameter follows:</p>
11936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
12036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>
12136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dd>
12236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
12336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
12436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dl class="dl-horizontal">
12536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>type</dt>
12636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>the pre-defined type of kernel wanted </dd>
12736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
12836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
12936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>args</dt>
13036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>arguments defining or modifying the kernel </dd>
13136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
13236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Convolution Kernels </dd>
13336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
13436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Unity The a No-Op or Scaling single element kernel. </dd>
13536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
13636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Gaussian:{radius},{sigma} Generate a two-dimensional gaussian kernel, as used by -gaussian. The sigma for the curve is required.  The resulting kernel is normalized, </dd>
13736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
13836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> If 'sigma' is zero, you get a single pixel on a field of zeros. </dd>
13936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
14036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> NOTE: that the 'radius' is optional, but if provided can limit (clip) the final size of the resulting kernel to a square 2*radius+1 in size. The radius should be at least 2 times that of the sigma value, or sever clipping and aliasing may result.  If not given or set to 0 the radius will be determined so as to produce the best minimal error result, which is usally much larger than is normally needed. </dd>
14136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
14236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> LoG:{radius},{sigma} "Laplacian of a Gaussian" or "Mexician Hat" Kernel. The supposed ideal edge detection, zero-summing kernel. </dd>
14336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
14436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> An alturnative to this kernel is to use a "DoG" with a sigma ratio of approx 1.6 (according to wikipedia). </dd>
14536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
14636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> DoG:{radius},{sigma1},{sigma2} "Difference of Gaussians" Kernel. As "Gaussian" but with a gaussian produced by 'sigma2' subtracted from the gaussian produced by 'sigma1'. Typically sigma2 &gt; sigma1. The result is a zero-summing kernel. </dd>
14736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
14836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Blur:{radius},{sigma}[,{angle}] Generates a 1 dimensional or linear gaussian blur, at the angle given (current restricted to orthogonal angles).  If a 'radius' is given the kernel is clipped to a width of 2*radius+1.  Kernel can be rotated by a 90 degree angle. </dd>
14936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
15036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> If 'sigma' is zero, you get a single pixel on a field of zeros. </dd>
15136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
15236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Note that two convolutions with two "Blur" kernels perpendicular to each other, is equivalent to a far larger "Gaussian" kernel with the same sigma value, However it is much faster to apply. This is how the "-blur" operator actually works. </dd>
15336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
15436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Comet:{width},{sigma},{angle} Blur in one direction only, much like how a bright object leaves a comet like trail.  The Kernel is actually half a gaussian curve, Adding two such blurs in opposite directions produces a Blur Kernel. Angle can be rotated in multiples of 90 degrees. </dd>
15536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
15636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Note that the first argument is the width of the kernel and not the radius of the kernel. </dd>
15736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
15836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Binomial:[{radius}] Generate a discrete kernel using a 2 dimentional Pascel's Triangle of values. Used for special forma of image filters. </dd>
15936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
16036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> # Still to be implemented... # # Filter2D # Filter1D #    Set kernel values using a resize filter, and given scale (sigma) #    Cylindrical or Linear.   Is this possible with an image? # </dd>
16136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
16236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Named Constant Convolution Kernels </dd>
16336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
16436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> All these are unscaled, zero-summing kernels by default. As such for non-HDRI version of ImageMagick some form of normalization, user scaling, and biasing the results is recommended, to prevent the resulting image being 'clipped'. </dd>
16536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
16636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> The 3x3 kernels (most of these) can be circularly rotated in multiples of 45 degrees to generate the 8 angled varients of each of the kernels. </dd>
16736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
16836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Laplacian:{type} Discrete Lapacian Kernels, (without normalization) Type 0 :  3x3 with center:8 surounded by -1  (8 neighbourhood) Type 1 :  3x3 with center:4 edge:-1 corner:0 (4 neighbourhood) Type 2 :  3x3 with center:4 edge:1 corner:-2 Type 3 :  3x3 with center:4 edge:-2 corner:1 Type 5 :  5x5 laplacian Type 7 :  7x7 laplacian Type 15 : 5x5 LoG (sigma approx 1.4) Type 19 : 9x9 LoG (sigma approx 1.4) </dd>
16936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
17036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Sobel:{angle} Sobel 'Edge' convolution kernel (3x3) | -1, 0, 1 | | -2, 0,-2 | | -1, 0, 1 | </dd>
17136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
17236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Roberts:{angle} Roberts convolution kernel (3x3) |  0, 0, 0 | | -1, 1, 0 | |  0, 0, 0 | </dd>
17336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
17436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Prewitt:{angle} Prewitt Edge convolution kernel (3x3) | -1, 0, 1 | | -1, 0, 1 | | -1, 0, 1 | </dd>
17536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
17636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Compass:{angle} Prewitt's "Compass" convolution kernel (3x3) | -1, 1, 1 | | -1,-2, 1 | | -1, 1, 1 | </dd>
17736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
17836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Kirsch:{angle} Kirsch's "Compass" convolution kernel (3x3) | -3,-3, 5 | | -3, 0, 5 | | -3,-3, 5 | </dd>
17936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
18036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> FreiChen:{angle} Frei-Chen Edge Detector is based on a kernel that is similar to the Sobel Kernel, but is designed to be isotropic. That is it takes into account the distance of the diagonal in the kernel. </dd>
18136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
18236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> |   1,     0,   -1     | | sqrt(2), 0, -sqrt(2) | |   1,     0,   -1     | </dd>
18336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
18436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> FreiChen:{type},{angle} </dd>
18536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
18636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Frei-Chen Pre-weighted kernels... </dd>
18736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
18836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Type 0:  default un-nomalized version shown above. </dd>
18936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
19036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Type 1: Orthogonal Kernel (same as type 11 below) |   1,     0,   -1     | | sqrt(2), 0, -sqrt(2) | / 2*sqrt(2) |   1,     0,   -1     | </dd>
19136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
19236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Type 2: Diagonal form of Kernel... |   1,     sqrt(2),    0     | | sqrt(2),   0,     -sqrt(2) | / 2*sqrt(2) |   0,    -sqrt(2)    -1     | </dd>
19336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
19436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> However this kernel is als at the heart of the FreiChen Edge Detection Process which uses a set of 9 specially weighted kernel.  These 9 kernels not be normalized, but directly applied to the image. The results is then added together, to produce the intensity of an edge in a specific direction.  The square root of the pixel value can then be taken as the cosine of the edge, and at least 2 such runs at 90 degrees from each other, both the direction and the strength of the edge can be determined. </dd>
19536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
19636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Type 10: All 9 of the following pre-weighted kernels... </dd>
19736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
19836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Type 11: |   1,     0,   -1     | | sqrt(2), 0, -sqrt(2) | / 2*sqrt(2) |   1,     0,   -1     | </dd>
19936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
20036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Type 12: | 1, sqrt(2), 1 | | 0,   0,     0 | / 2*sqrt(2) | 1, sqrt(2), 1 | </dd>
20136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
20236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Type 13: | sqrt(2), -1,    0     | |  -1,      0,    1     | / 2*sqrt(2) |   0,      1, -sqrt(2) | </dd>
20336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
20436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Type 14: |    0,     1, -sqrt(2) | |   -1,     0,     1    | / 2*sqrt(2) | sqrt(2), -1,     0    | </dd>
20536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
20636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Type 15: | 0, -1, 0 | | 1,  0, 1 | / 2 | 0, -1, 0 | </dd>
20736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
20836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Type 16: |  1, 0, -1 | |  0, 0,  0 | / 2 | -1, 0,  1 | </dd>
20936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
21036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Type 17: |  1, -2,  1 | | -2,  4, -2 | / 6 | -1, -2,  1 | </dd>
21136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
21236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Type 18: | -2, 1, -2 | |  1, 4,  1 | / 6 | -2, 1, -2 | </dd>
21336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
21436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Type 19: | 1, 1, 1 | | 1, 1, 1 | / 3 | 1, 1, 1 | </dd>
21536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
21636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> The first 4 are for edge detection, the next 4 are for line detection and the last is to add a average component to the results. </dd>
21736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
21836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Using a special type of '-1' will return all 9 pre-weighted kernels as a multi-kernel list, so that you can use them directly (without normalization) with the special "-set option:morphology:compose Plus" setting to apply the full FreiChen Edge Detection Technique. </dd>
21936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
22036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> If 'type' is large it will be taken to be an actual rotation angle for the default FreiChen (type 0) kernel.  As such  FreiChen:45  will look like a  Sobel:45  but with 'sqrt(2)' instead of '2' values. </dd>
22136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
22236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> WARNING: The above was layed out as per http://www.math.tau.ac.il/~turkel/notes/edge_detectors.pdf But rotated 90 degrees so direction is from left rather than the top. I have yet to find any secondary confirmation of the above. The only other source found was actual source code at http://ltswww.epfl.ch/~courstiv/exos_labos/sol3.pdf Neigher paper defineds the kernels in a way that looks locical or correct when taken as a whole. </dd>
22336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
22436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Boolean Kernels </dd>
22536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
22636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Diamond:[{radius}[,{scale}]] Generate a diamond shaped kernel with given radius to the points. Kernel size will again be radius*2+1 square and defaults to radius 1, generating a 3x3 kernel that is slightly larger than a square. </dd>
22736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
22836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Square:[{radius}[,{scale}]] Generate a square shaped kernel of size radius*2+1, and defaulting to a 3x3 (radius 1). </dd>
22936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
23036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Octagon:[{radius}[,{scale}]] Generate octagonal shaped kernel of given radius and constant scale. Default radius is 3 producing a 7x7 kernel. A radius of 1 will result in "Diamond" kernel. </dd>
23136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
23236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Disk:[{radius}[,{scale}]] Generate a binary disk, thresholded at the radius given, the radius may be a float-point value. Final Kernel size is floor(radius)*2+1 square. A radius of 5.3 is the default. </dd>
23336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
23436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> NOTE: That a low radii Disk kernels produce the same results as many of the previously defined kernels, but differ greatly at larger radii.  Here is a table of equivalences... "Disk:1"    =&gt; "Diamond", "Octagon:1", or "Cross:1" "Disk:1.5"  =&gt; "Square" "Disk:2"    =&gt; "Diamond:2" "Disk:2.5"  =&gt; "Octagon" "Disk:2.9"  =&gt; "Square:2" "Disk:3.5"  =&gt; "Octagon:3" "Disk:4.5"  =&gt; "Octagon:4" "Disk:5.4"  =&gt; "Octagon:5" "Disk:6.4"  =&gt; "Octagon:6" All other Disk shapes are unique to this kernel, but because a "Disk" is more circular when using a larger radius, using a larger radius is preferred over iterating the morphological operation. </dd>
23536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
23636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Rectangle:{geometry} Simply generate a rectangle of 1's with the size given. You can also specify the location of the 'control point', otherwise the closest pixel to the center of the rectangle is selected. </dd>
23736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
23836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Properly centered and odd sized rectangles work the best. </dd>
23936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
24036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Symbol Dilation Kernels </dd>
24136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
24236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> These kernel is not a good general morphological kernel, but is used more for highlighting and marking any single pixels in an image using, a "Dilate" method as appropriate. </dd>
24336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
24436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> For the same reasons iterating these kernels does not produce the same result as using a larger radius for the symbol. </dd>
24536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
24636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Plus:[{radius}[,{scale}]] Cross:[{radius}[,{scale}]] Generate a kernel in the shape of a 'plus' or a 'cross' with a each arm the length of the given radius (default 2). </dd>
24736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
24836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> NOTE: "plus:1" is equivalent to a "Diamond" kernel. </dd>
24936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
25036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Ring:{radius1},{radius2}[,{scale}] A ring of the values given that falls between the two radii. Defaults to a ring of approximataly 3 radius in a 7x7 kernel. This is the 'edge' pixels of the default "Disk" kernel, More specifically, "Ring" -&gt; "Ring:2.5,3.5,1.0" </dd>
25136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
25236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Hit and Miss Kernels </dd>
25336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
25436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Peak:radius1,radius2 Find any peak larger than the pixels the fall between the two radii. The default ring of pixels is as per "Ring". Edges Find flat orthogonal edges of a binary shape Corners Find 90 degree corners of a binary shape Diagonals:type A special kernel to thin the 'outside' of diagonals LineEnds:type Find end points of lines (for pruning a skeletion) Two types of lines ends (default to both) can be searched for Type 0: All line ends Type 1: single kernel for 4-conneected line ends Type 2: single kernel for simple line ends LineJunctions Find three line junctions (within a skeletion) Type 0: all line junctions Type 1: Y Junction kernel Type 2: Diagonal T Junction kernel Type 3: Orthogonal T Junction kernel Type 4: Diagonal X Junction kernel Type 5: Orthogonal + Junction kernel Ridges:type Find single pixel ridges or thin lines Type 1: Fine single pixel thick lines and ridges Type 2: Find two pixel thick lines and ridges ConvexHull Octagonal Thickening Kernel, to generate convex hulls of 45 degrees Skeleton:type Traditional skeleton generating kernels. Type 1: Tradional Skeleton kernel (4 connected skeleton) Type 2: HIPR2 Skeleton kernel (8 connected skeleton) Type 3: Thinning skeleton based on a ressearch paper by Dan S. Bloomberg (Default Type) ThinSE:type A huge variety of Thinning Kernels designed to preserve conectivity. many other kernel sets use these kernels as source definitions. Type numbers are 41-49, 81-89, 481, and 482 which are based on the super and sub notations used in the source research paper. </dd>
25536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
25636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Distance Measuring Kernels </dd>
25736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
25836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Different types of distance measuring methods, which are used with the a 'Distance' morphology method for generating a gradient based on distance from an edge of a binary shape, though there is a technique for handling a anti-aliased shape. </dd>
25936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
26036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> See the 'Distance' Morphological Method, for information of how it is applied. </dd>
26136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
26236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Chebyshev:[{radius}][x{scale}[!]] Chebyshev Distance (also known as Tchebychev or Chessboard distance) is a value of one to any neighbour, orthogonal or diagonal. One why of thinking of it is the number of squares a 'King' or 'Queen' in chess needs to traverse reach any other position on a chess board. It results in a 'square' like distance function, but one where diagonals are given a value that is closer than expected. </dd>
26336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
26436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Manhattan:[{radius}][x{scale}[!]] Manhattan Distance (also known as Rectilinear, City Block, or the Taxi Cab distance metric), it is the distance needed when you can only travel in horizontal or vertical directions only.  It is the distance a 'Rook' in chess would have to travel, and results in a diamond like distances, where diagonals are further than expected. </dd>
26536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
26636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Octagonal:[{radius}][x{scale}[!]] An interleving of Manhatten and Chebyshev metrics producing an increasing octagonally shaped distance.  Distances matches those of the "Octagon" shaped kernel of the same radius.  The minimum radius and default is 2, producing a 5x5 kernel. </dd>
26736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
26836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> Euclidean:[{radius}][x{scale}[!]] Euclidean distance is the 'direct' or 'as the crow flys' distance. However by default the kernel size only has a radius of 1, which limits the distance to 'Knight' like moves, with only orthogonal and diagonal measurements being correct.  As such for the default kernel you will get octagonal like distance function. </dd>
26936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
27036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> However using a larger radius such as "Euclidean:4" you will get a much smoother distance gradient from the edge of the shape. Especially if the image is pre-processed to include any anti-aliasing pixels. Of course a larger kernel is slower to use, and not always needed. </dd>
27136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
27236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> The first three Distance Measuring Kernels will only generate distances of exact multiples of {scale} in binary images. As such you can use a scale of 1 without loosing any information.  However you also need some scaling when handling non-binary anti-aliased shapes. </dd>
27336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
27436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> The "Euclidean" Distance Kernel however does generate a non-integer fractional results, and as such scaling is vital even for binary shapes. </dd>
27536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
27636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>  </dd>
27736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dl>
27836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/morphology_8c.html" id="CloneKernelInfo">CloneKernelInfo</a></h2>
27936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
28036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>CloneKernelInfo() creates a new clone of the given Kernel List so that its can be modified without effecting the original.  The cloned kernel should be destroyed using DestoryKernelInfo() when no longer needed.</p>
28136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
28236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The format of the CloneKernelInfo method is:</p>
28336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
28436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
28536421ee45722da418b8ab99d7e6358e4f86b9f1eCristyKernelInfo *CloneKernelInfo(const KernelInfo *kernel)
28636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
28736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
28836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>A description of each parameter follows:</p>
28936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
29036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>
29136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dd>
29236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
29336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
29436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dl class="dl-horizontal">
29536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>kernel</dt>
29636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>the Morphology/Convolution kernel to be cloned </dd>
29736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
29836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>  </dd>
29936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dl>
30036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/morphology_8c.html" id="DestroyKernelInfo">DestroyKernelInfo</a></h2>
30136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
30236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>DestroyKernelInfo() frees the memory used by a Convolution/Morphology kernel.</p>
30336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
30436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The format of the DestroyKernelInfo method is:</p>
30536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
30636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
30736421ee45722da418b8ab99d7e6358e4f86b9f1eCristyKernelInfo *DestroyKernelInfo(KernelInfo *kernel)
30836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
30936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
31036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>A description of each parameter follows:</p>
31136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
31236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>
31336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dd>
31436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
31536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
31636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dl class="dl-horizontal">
31736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>kernel</dt>
31836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>the Morphology/Convolution kernel to be destroyed </dd>
31936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
32036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>  </dd>
32136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dl>
32236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/morphology_8c.html" id="MorphologyApply">MorphologyApply</a></h2>
32336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
32436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>MorphologyApply() applies a morphological method, multiple times using a list of multiple kernels.  This is the method that should be called by other 'operators' that internally use morphology operations as part of their processing.</p>
32536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
32636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>It is basically equivalent to as MorphologyImage() (see below) but without any user controls.  This allows internel programs to use this method to perform a specific task without possible interference by any API user supplied settings.</p>
32736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
32836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>It is MorphologyImage() task to extract any such user controls, and pass them to this function for processing.</p>
32936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
33036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>More specifically all given kernels should already be scaled, normalised, and blended appropriatally before being parred to this routine. The appropriate bias, and compose (typically 'UndefinedComposeOp') given.</p>
33136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
33236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The format of the MorphologyApply method is:</p>
33336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
33436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
33536421ee45722da418b8ab99d7e6358e4f86b9f1eCristyImage *MorphologyApply(const Image *image,MorphologyMethod method,
33636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  const ssize_t iterations,const KernelInfo *kernel,
33736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  const CompositeMethod compose,const double bias,
33836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  ExceptionInfo *exception)
33936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
34036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
34136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>A description of each parameter follows:</p>
34236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
34336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>
34436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dd>
34536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
34636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
34736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dl class="dl-horizontal">
34836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>image</dt>
34936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>the source image </dd>
35036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
35136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
35236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>method</dt>
35336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>the morphology method to be applied. </dd>
35436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
35536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
35636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>iterations</dt>
35736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>apply the operation this many times (or no change). A value of -1 means loop until no change found. How this is applied may depend on the morphology method. Typically this is a value of 1. </dd>
35836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
35936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
36036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>channel</dt>
36136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>the channel type. </dd>
36236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
36336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
36436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>kernel</dt>
36536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>An array of double representing the morphology kernel. </dd>
36636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
36736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
36836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>compose</dt>
36936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>How to handle or merge multi-kernel results. If 'UndefinedCompositeOp' use default for the Morphology method. If 'NoCompositeOp' force image to be re-iterated by each kernel. Otherwise merge the results using the compose method given. </dd>
37036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
37136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
37236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>bias</dt>
37336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>Convolution Output Bias. </dd>
37436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
37536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
37636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>exception</dt>
37736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>return any errors or warnings in this structure. </dd>
37836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
37936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>  </dd>
38036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dl>
38136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/morphology_8c.html" id="This_is almost identical to the MorphologyPrimative">This is almost identical to the MorphologyPrimative</a></h2>
38236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
38336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>This is almost identical to the MorphologyPrimative() function above, but applies the primitive directly to the actual image using two passes, once in each direction, with the results of the previous (and current) row being re-used.</p>
38436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
38536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>That is after each row is 'Sync'ed' into the image, the next row makes use of those values as part of the calculation of the next row.  It repeats, but going in the oppisite (bottom-up) direction.</p>
38636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
38736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>Because of this 're-use of results' this function can not make use of multi- threaded, parellel processing. </p>
38836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/morphology_8c.html" id="MorphologyImage">MorphologyImage</a></h2>
38936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
39036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>MorphologyImage() applies a user supplied kernel to the image according to the given mophology method.</p>
39136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
39236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>This function applies any and all user defined settings before calling the above internal function MorphologyApply().</p>
39336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
39436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>User defined settings include... * Output Bias for Convolution and correlation ("-define convolve:bias=??") * Kernel Scale/normalize settings            ("-define convolve:scale=??") This can also includes the addition of a scaled unity kernel. * Show Kernel being applied            ("-define morphology:showkernel=1")</p>
39536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
39636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>Other operators that do not want user supplied options interfering, especially "convolve:bias" and "morphology:showkernel" should use MorphologyApply() directly.</p>
39736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
39836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The format of the MorphologyImage method is:</p>
39936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
40036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
40136421ee45722da418b8ab99d7e6358e4f86b9f1eCristyImage *MorphologyImage(const Image *image,MorphologyMethod method,
40236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  const ssize_t iterations,KernelInfo *kernel,ExceptionInfo *exception)
40336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
40436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
40536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>A description of each parameter follows:</p>
40636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
40736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>
40836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dd>
40936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
41036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
41136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dl class="dl-horizontal">
41236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>image</dt>
41336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>the image. </dd>
41436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
41536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
41636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>method</dt>
41736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>the morphology method to be applied. </dd>
41836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
41936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
42036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>iterations</dt>
42136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>apply the operation this many times (or no change). A value of -1 means loop until no change found. How this is applied may depend on the morphology method. Typically this is a value of 1. </dd>
42236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
42336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
42436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>kernel</dt>
42536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>An array of double representing the morphology kernel. Warning: kernel may be normalized for the Convolve method. </dd>
42636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
42736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
42836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>exception</dt>
42936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>return any errors or warnings in this structure. </dd>
43036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
43136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>  </dd>
43236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dl>
43336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/morphology_8c.html" id="ScaleGeometryKernelInfo">ScaleGeometryKernelInfo</a></h2>
43436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
43536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>ScaleGeometryKernelInfo() takes a geometry argument string, typically provided as a  "-set option:convolve:scale {geometry}" user setting, and modifies the kernel according to the parsed arguments of that setting.</p>
43636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
43736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The first argument (and any normalization flags) are passed to ScaleKernelInfo() to scale/normalize the kernel.  The second argument is then passed to UnityAddKernelInfo() to add a scled unity kernel into the scaled/normalized kernel.</p>
43836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
43936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The format of the ScaleGeometryKernelInfo method is:</p>
44036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
44136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
44236421ee45722da418b8ab99d7e6358e4f86b9f1eCristyvoid ScaleGeometryKernelInfo(KernelInfo *kernel,
44336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  const double scaling_factor,const MagickStatusType normalize_flags)
44436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
44536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
44636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>A description of each parameter follows:</p>
44736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
44836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>
44936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dd>
45036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
45136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
45236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dl class="dl-horizontal">
45336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>kernel</dt>
45436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>the Morphology/Convolution kernel to modify </dd>
45536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
45636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> o geometry: </dd>
45736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
45836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
45936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy       "-set option:convolve:scale {geometry}" setting.
46036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
46136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
46236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p></dd>
46336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dl>
46436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/morphology_8c.html" id="ScaleKernelInfo">ScaleKernelInfo</a></h2>
46536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
46636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>ScaleKernelInfo() scales the given kernel list by the given amount, with or without normalization of the sum of the kernel values (as per given flags).</p>
46736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
46836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>By default (no flags given) the values within the kernel is scaled directly using given scaling factor without change.</p>
46936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
47036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>If either of the two 'normalize_flags' are given the kernel will first be normalized and then further scaled by the scaling factor value given.</p>
47136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
47236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>Kernel normalization ('normalize_flags' given) is designed to ensure that any use of the kernel scaling factor with 'Convolve' or 'Correlate' morphology methods will fall into -1.0 to +1.0 range.  Note that for non-HDRI versions of IM this may cause images to have any negative results clipped, unless some 'bias' is used.</p>
47336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
47436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>More specifically.  Kernels which only contain positive values (such as a 'Gaussian' kernel) will be scaled so that those values sum to +1.0, ensuring a 0.0 to +1.0 output range for non-HDRI images.</p>
47536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
47636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>For Kernels that contain some negative values, (such as 'Sharpen' kernels) the kernel will be scaled by the absolute of the sum of kernel values, so that it will generally fall within the +/- 1.0 range.</p>
47736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
47836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>For kernels whose values sum to zero, (such as 'Laplician' kernels) kernel will be scaled by just the sum of the postive values, so that its output range will again fall into the  +/- 1.0 range.</p>
47936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
48036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>For special kernels designed for locating shapes using 'Correlate', (often only containing +1 and -1 values, representing foreground/brackground matching) a special normalization method is provided to scale the positive values separately to those of the negative values, so the kernel will be forced to become a zero-sum kernel better suited to such searches.</p>
48136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
48236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>WARNING: Correct normalization of the kernel assumes that the '*_range' attributes within the kernel structure have been correctly set during the kernels creation.</p>
48336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
48436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>NOTE: The values used for 'normalize_flags' have been selected specifically to match the use of geometry options, so that '!' means NormalizeValue, '^' means CorrelateNormalizeValue.  All other GeometryFlags values are ignored.</p>
48536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
48636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The format of the ScaleKernelInfo method is:</p>
48736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
48836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
48936421ee45722da418b8ab99d7e6358e4f86b9f1eCristyvoid ScaleKernelInfo(KernelInfo *kernel, const double scaling_factor,
49036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy         const MagickStatusType normalize_flags )
49136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
49236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
49336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>A description of each parameter follows:</p>
49436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
49536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>
49636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dd>
49736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
49836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
49936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dl class="dl-horizontal">
50036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>kernel</dt>
50136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>the Morphology/Convolution kernel </dd>
50236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
50336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> o scaling_factor: </dd>
50436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
50536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
50636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy       zero.  If the kernel is normalized regardless of any flags.
50736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
50836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
50936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>o normalize_flags: </dd>
51036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
51136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
51236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy       specifically: NormalizeValue, CorrelateNormalizeValue,
51336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy                     and/or PercentValue
51436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
51536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
51636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p></dd>
51736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dl>
51836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/morphology_8c.html" id="ShowKernelInfo">ShowKernelInfo</a></h2>
51936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
52036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>ShowKernelInfo() outputs the details of the given kernel defination to standard error, generally due to a users 'morphology:showkernel' option request.</p>
52136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
52236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The format of the ShowKernel method is:</p>
52336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
52436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
52536421ee45722da418b8ab99d7e6358e4f86b9f1eCristyvoid ShowKernelInfo(const KernelInfo *kernel)
52636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
52736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
52836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>A description of each parameter follows:</p>
52936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
53036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>
53136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dd>
53236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
53336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
53436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dl class="dl-horizontal">
53536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>kernel</dt>
53636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>the Morphology/Convolution kernel </dd>
53736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
53836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>  </dd>
53936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dl>
54036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/morphology_8c.html" id="UnityAddKernelInfo">UnityAddKernelInfo</a></h2>
54136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
54236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>UnityAddKernelInfo() Adds a given amount of the 'Unity' Convolution Kernel to the given pre-scaled and normalized Kernel.  This in effect adds that amount of the original image into the resulting convolution kernel.  This value is usually provided by the user as a percentage value in the 'convolve:scale' setting.</p>
54336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
54436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The resulting effect is to convert the defined kernels into blended soft-blurs, unsharp kernels or into sharpening kernels.</p>
54536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
54636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The format of the UnityAdditionKernelInfo method is:</p>
54736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
54836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
54936421ee45722da418b8ab99d7e6358e4f86b9f1eCristyvoid UnityAdditionKernelInfo(KernelInfo *kernel, const double scale )
55036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
55136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
55236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>A description of each parameter follows:</p>
55336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
55436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>
55536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dd>
55636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
55736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
55836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dl class="dl-horizontal">
55936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>kernel</dt>
56036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>the Morphology/Convolution kernel </dd>
56136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
56236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> o scale: </dd>
56336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
56436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
56536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy       the given kernel.
56636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
56736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
56836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p></dd>
56936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dl>
57036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/morphology_8c.html" id="ZeroKernelNans">ZeroKernelNans</a></h2>
57136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
57236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>ZeroKernelNans() replaces any special 'nan' value that may be present in the kernel with a zero value.  This is typically done when the kernel will be used in special hardware (GPU) convolution processors, to simply matters.</p>
57336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
57436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>The format of the ZeroKernelNans method is:</p>
57536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
57636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<pre class="text">
57736421ee45722da418b8ab99d7e6358e4f86b9f1eCristyvoid ZeroKernelNans (KernelInfo *kernel)
57836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</pre>
57936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
58036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<p>A description of each parameter follows:</p>
58136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
58236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>
58336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dd>
58436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
58536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd> </dd>
58636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dl class="dl-horizontal">
58736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dt>kernel</dt>
58836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>the Morphology/Convolution kernel </dd>
58936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
59036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy<dd>  </dd>
59136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</dl>
59236421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</div>
59336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <footer class="magick-footer">
59436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy    <p><a href="../script/support.php">Donate</a> •
59536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy     <a href="../script/sitemap.php">Sitemap</a> •
59636421ee45722da418b8ab99d7e6358e4f86b9f1eCristy    <a href="../script/links.php">Related</a> •
59736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy    <a href="../script/architecture.php">Architecture</a>
59836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</p>
59936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy    <p><a href="morphology.php#">Back to top</a> •
60036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy    <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> •
60136421ee45722da418b8ab99d7e6358e4f86b9f1eCristy    <a href="../script/contact.php">Contact Us</a></p>
6027ce65e7125a4e1df1a274ce373c537a9df9c16cdCristy        <p><small1999-2016 ImageMagick Studio LLC</small></p>
60336421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  </footer>
60436421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</div><!-- /.container -->
60536421ee45722da418b8ab99d7e6358e4f86b9f1eCristy
606882d9f4ab22246b0110b960e923614ae9c53702aCristy  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
60736421ee45722da418b8ab99d7e6358e4f86b9f1eCristy  <script src="http://nextgen.imagemagick.org/js/magick.php"></script>
60836421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</div>
60936421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</body>
61036421ee45722da418b8ab99d7e6358e4f86b9f1eCristy</html>
611