MagickCore  6.7.7
morphology.h
Go to the documentation of this file.
00001 /*
00002   Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
00003   dedicated to making software imaging solutions freely available.
00004   
00005   You may not use this file except in compliance with the License.
00006   obtain a copy of the License at
00007   
00008     http://www.imagemagick.org/script/license.php
00009   
00010   Unless required by applicable law or agreed to in writing, software
00011   distributed under the License is distributed on an "AS IS" BASIS,
00012   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013   See the License for the specific language governing permissions and
00014   limitations under the License.
00015 
00016   MagickCore morphology methods.
00017 */
00018 #ifndef _MAGICKCORE_MORPHOLOGY_H
00019 #define _MAGICKCORE_MORPHOLOGY_H
00020 
00021 #if defined(__cplusplus) || defined(c_plusplus)
00022 extern "C" {
00023 #endif
00024 
00025 #include <MagickCore/geometry.h>
00026 
00027 typedef enum
00028 {
00029   UndefinedKernel,    /* equivalent to UnityKernel */
00030   UnityKernel,        /* The no-op or 'original image' kernel */
00031   GaussianKernel,     /* Convolution Kernels, Gaussian Based */
00032   DoGKernel,
00033   LoGKernel,
00034   BlurKernel,
00035   CometKernel,
00036   LaplacianKernel,    /* Convolution Kernels, by Name */
00037   SobelKernel,
00038   FreiChenKernel,
00039   RobertsKernel,
00040   PrewittKernel,
00041   CompassKernel,
00042   KirschKernel,
00043   DiamondKernel,      /* Shape Kernels */
00044   SquareKernel,
00045   RectangleKernel,
00046   OctagonKernel,
00047   DiskKernel,
00048   PlusKernel,
00049   CrossKernel,
00050   RingKernel,
00051   PeaksKernel,         /* Hit And Miss Kernels */
00052   EdgesKernel,
00053   CornersKernel,
00054   DiagonalsKernel,
00055   LineEndsKernel,
00056   LineJunctionsKernel,
00057   RidgesKernel,
00058   ConvexHullKernel,
00059   ThinSEKernel,
00060   SkeletonKernel,
00061   ChebyshevKernel,    /* Distance Measuring Kernels */
00062   ManhattanKernel,
00063   OctagonalKernel,
00064   EuclideanKernel,
00065   UserDefinedKernel   /* User Specified Kernel Array */
00066 } KernelInfoType;
00067 
00068 typedef enum
00069 {
00070   UndefinedMorphology,
00071 /* Convolve / Correlate weighted sums */
00072   ConvolveMorphology,           /* Weighted Sum with reflected kernel */
00073   CorrelateMorphology,          /* Weighted Sum using a sliding window */
00074 /* Low-level Morphology methods */
00075   ErodeMorphology,              /* Minimum Value in Neighbourhood */
00076   DilateMorphology,             /* Maximum Value in Neighbourhood */
00077   ErodeIntensityMorphology,     /* Pixel Pick using GreyScale Erode */
00078   DilateIntensityMorphology,    /* Pixel Pick using GreyScale Dialate */
00079   IterativeDistanceMorphology,  /* Add Kernel Value, take Minimum */
00080 /* Second-level Morphology methods */
00081   OpenMorphology,               /* Dilate then Erode */
00082   CloseMorphology,              /* Erode then Dilate */
00083   OpenIntensityMorphology,      /* Pixel Pick using GreyScale Open */
00084   CloseIntensityMorphology,     /* Pixel Pick using GreyScale Close */
00085   SmoothMorphology,             /* Open then Close */
00086 /* Difference Morphology methods */
00087   EdgeInMorphology,             /* Dilate difference from Original */
00088   EdgeOutMorphology,            /* Erode difference from Original */
00089   EdgeMorphology,               /* Dilate difference with Erode */
00090   TopHatMorphology,             /* Close difference from Original */
00091   BottomHatMorphology,          /* Open difference from Original */
00092 /* Recursive Morphology methods */
00093   HitAndMissMorphology,         /* Foreground/Background pattern matching */
00094   ThinningMorphology,           /* Remove matching pixels from image */
00095   ThickenMorphology,            /* Add matching pixels from image */
00096 /* Directly Applied Morphology methods */
00097   DistanceMorphology,           /* Add Kernel Value, take Minimum */
00098   VoronoiMorphology             /* Distance matte channel copy nearest color */
00099 } MorphologyMethod;
00100 
00101 typedef struct _KernelInfo
00102 {
00103   KernelInfoType
00104     type;
00105 
00106   size_t
00107     width,
00108     height;
00109 
00110   ssize_t
00111     x,
00112     y;
00113 
00114   double
00115     *values,
00116     minimum,
00117     maximum,
00118     negative_range,
00119     positive_range,
00120     angle;
00121 
00122   struct _KernelInfo
00123     *next;
00124 
00125   size_t
00126     signature;
00127 } KernelInfo;
00128 
00129 extern MagickExport KernelInfo
00130   *AcquireKernelInfo(const char *),
00131   *AcquireKernelBuiltIn(const KernelInfoType,const GeometryInfo *),
00132   *CloneKernelInfo(const KernelInfo *),
00133   *DestroyKernelInfo(KernelInfo *);
00134 
00135 extern MagickExport Image
00136   *MorphologyImage(const Image *,const MorphologyMethod,const ssize_t,
00137     const KernelInfo *,ExceptionInfo *);
00138 
00139 extern MagickExport void
00140   ScaleGeometryKernelInfo(KernelInfo *,const char *),
00141   ScaleKernelInfo(KernelInfo *,const double,const GeometryFlags),
00142   UnityAddKernelInfo(KernelInfo *,const double);
00143 
00144 #if defined(__cplusplus) || defined(c_plusplus)
00145 }
00146 #endif
00147 
00148 #endif