#include "MagickCore/studio.h"#include "MagickCore/cache.h"#include "MagickCore/color.h"#include "MagickCore/colormap.h"#include "MagickCore/colorspace.h"#include "MagickCore/colorspace-private.h"#include "MagickCore/exception.h"#include "MagickCore/exception-private.h"#include "MagickCore/image.h"#include "MagickCore/image-private.h"#include "MagickCore/memory_.h"#include "MagickCore/memory-private.h"#include "MagickCore/monitor.h"#include "MagickCore/monitor-private.h"#include "MagickCore/pixel-accessor.h"#include "MagickCore/pixel-private.h"#include "MagickCore/quantize.h"#include "MagickCore/quantum.h"#include "MagickCore/quantum-private.h"#include "MagickCore/resource_.h"#include "MagickCore/segment.h"#include "MagickCore/string_.h"#include "MagickCore/thread-private.h"Data Structures | |
| struct | _ExtentPacket |
| struct | _Cluster |
| struct | _IntervalTree |
| struct | _ZeroCrossing |
Defines | |
| #define | MaxDimension 3 |
| #define | DeltaTau 0.5f |
| #define | WeightingExponent 2.5 |
| #define | SegmentPower(ratio) pow(ratio,(double) (1.0/(weighting_exponent-1.0))); |
| #define | Tau 5.2f |
| #define | SegmentImageTag "Segment/Image" |
| #define | ThrowClassifyException(severity, tag, label) |
Typedefs | |
| typedef struct _ExtentPacket | ExtentPacket |
| typedef struct _Cluster | Cluster |
| typedef struct _IntervalTree | IntervalTree |
| typedef struct _ZeroCrossing | ZeroCrossing |
Functions | |
| static double | OptimalTau (const ssize_t *, const double, const double, const double, const double, short *) |
| static ssize_t | DefineRegion (const short *, ExtentPacket *) |
| static void | FreeNodes (IntervalTree *) |
| static void | InitializeHistogram (const Image *, ssize_t **, ExceptionInfo *) |
| static void | ScaleSpace (const ssize_t *, const double, double *) |
| static void | ZeroCrossHistogram (double *, const double, short *) |
| static MagickBooleanType | Classify (Image *image, short **extrema, const double cluster_threshold, const double weighting_exponent, const MagickBooleanType verbose, ExceptionInfo *exception) |
| static void | ConsolidateCrossings (ZeroCrossing *zero_crossing, const size_t number_crossings) |
| static void | DerivativeHistogram (const double *histogram, double *derivative) |
| MagickExport MagickBooleanType | GetImageDynamicThreshold (const Image *image, const double cluster_threshold, const double smooth_threshold, PixelInfo *pixel, ExceptionInfo *exception) |
| static void | InitializeList (IntervalTree **list, ssize_t *number_nodes, IntervalTree *node) |
| static void | MeanStability (IntervalTree *node) |
| static void | Stability (IntervalTree *node) |
| static IntervalTree * | InitializeIntervalTree (const ZeroCrossing *zero_crossing, const size_t number_crossings) |
| static void | ActiveNodes (IntervalTree **list, ssize_t *number_nodes, IntervalTree *node) |
| MagickExport MagickBooleanType | SegmentImage (Image *image, const ColorspaceType colorspace, const MagickBooleanType verbose, const double cluster_threshold, const double smooth_threshold, ExceptionInfo *exception) |
Variables | |
| static const int | Blue = 2 |
| static const int | Green = 1 |
| static const int | Red = 0 |
| static const int | SafeMargin = 3 |
| static const int | TreeLength = 600 |
| #define DeltaTau 0.5f |
Referenced by GetImageDynamicThreshold(), and SegmentImage().
| #define MaxDimension 3 |
Referenced by Classify(), GetImageDynamicThreshold(), and SegmentImage().
| #define SegmentImageTag "Segment/Image" |
Referenced by Classify(), and GetImageDynamicThreshold().
| #define SegmentPower | ( | ratio | ) | pow(ratio,(double) (1.0/(weighting_exponent-1.0))); |
Referenced by Classify().
| #define Tau 5.2f |
Referenced by GetImageDynamicThreshold(), and SegmentImage().
| #define ThrowClassifyException | ( | severity, | |||
| tag, | |||||
| label | ) |
{\
for (cluster=head; cluster != (Cluster *) NULL; cluster=next_cluster) \
{ \
next_cluster=cluster->next; \
cluster=(Cluster *) RelinquishMagickMemory(cluster); \
} \
if (squares != (double *) NULL) \
{ \
squares-=255; \
free_squares=squares; \
free_squares=(double *) RelinquishMagickMemory(free_squares); \
} \
ThrowBinaryException(severity,tag,label); \
}
Referenced by Classify().
| #define WeightingExponent 2.5 |
Referenced by SegmentImage().
| typedef struct _ExtentPacket ExtentPacket |
| typedef struct _IntervalTree IntervalTree |
| typedef struct _ZeroCrossing ZeroCrossing |
| static void ActiveNodes | ( | IntervalTree ** | list, | |
| ssize_t * | number_nodes, | |||
| IntervalTree * | node | |||
| ) | [static] |
References _IntervalTree::child, _IntervalTree::mean_stability, _IntervalTree::sibling, and _IntervalTree::stability.
Referenced by OptimalTau().
| static MagickBooleanType Classify | ( | Image * | image, | |
| short ** | extrema, | |||
| const double | cluster_threshold, | |||
| const double | weighting_exponent, | |||
| const MagickBooleanType | verbose, | |||
| ExceptionInfo * | exception | |||
| ) | [static] |
References AcquireAuthenticCacheView(), AcquireImageColormap(), AcquireQuantumMemory(), AcquireVirtualCacheView(), _PixelInfo::blue, _Cluster::blue, Blue, _ExtentPacket::center, ClampToQuantum(), _Image::colormap, _Image::colors, _Image::columns, _Cluster::count, DefineRegion(), DestroyCacheView(), _Image::filename, FormatLocaleFile(), GetCacheViewAuthenticPixels(), GetCacheViewVirtualPixels(), GetPixelBlue(), GetPixelChannels(), GetPixelGreen(), GetPixelRed(), _PixelInfo::green, _Cluster::green, Green, _Cluster::id, ImageError, _ExtentPacket::index, _ExtentPacket::left, magick_restrict, MagickFalse, MagickTrue, MaxDimension, _Cluster::next, _Image::progress_monitor, _PixelInfo::red, _Cluster::red, Red, RelinquishMagickMemory(), ResourceLimitError, _ExtentPacket::right, _Image::rows, SafeMargin, ScaleCharToQuantum(), ScaleQuantumToChar(), SegmentImageTag, SegmentPower, SetImageProgress(), SetPixelIndex(), SyncCacheViewAuthenticPixels(), SyncImage(), and ThrowClassifyException.
Referenced by SegmentImage().
| static void ConsolidateCrossings | ( | ZeroCrossing * | zero_crossing, | |
| const size_t | number_crossings | |||
| ) | [static] |
References _ZeroCrossing::crossings, MagickMax, and MagickMin.
Referenced by OptimalTau().
| static ssize_t DefineRegion | ( | const short * | extrema, | |
| ExtentPacket * | extents | |||
| ) | [static] |
References _ExtentPacket::center, _ExtentPacket::index, _ExtentPacket::left, MagickFalse, MagickTrue, and _ExtentPacket::right.
Referenced by Classify(), and GetImageDynamicThreshold().
| static void DerivativeHistogram | ( | const double * | histogram, | |
| double * | derivative | |||
| ) | [static] |
Referenced by OptimalTau().
| static void FreeNodes | ( | IntervalTree * | node | ) | [static] |
References _IntervalTree::child, RelinquishMagickMemory(), and _IntervalTree::sibling.
Referenced by InitializeIntervalTree(), and OptimalTau().
| MagickExport MagickBooleanType GetImageDynamicThreshold | ( | const Image * | image, | |
| const double | cluster_threshold, | |||
| const double | smooth_threshold, | |||
| PixelInfo * | pixel, | |||
| ExceptionInfo * | exception | |||
| ) |
References AcquireQuantumMemory(), _PixelInfo::blue, _Cluster::blue, Blue, _ExtentPacket::center, _Image::columns, _Cluster::count, _Image::debug, DefineRegion(), DeltaTau, _Image::filename, GetMagickModule, GetPixelBlue(), GetPixelChannels(), GetPixelGreen(), GetPixelInfo(), GetPixelRed(), GetVirtualPixels(), _PixelInfo::green, _Cluster::green, Green, _Cluster::id, _ExtentPacket::index, InitializeHistogram(), _ExtentPacket::left, LogMagickEvent(), MagickCoreSignature, MagickFalse, MagickTrue, MaxDimension, _Cluster::next, OptimalTau(), _PixelInfo::red, _Cluster::red, Red, RelinquishMagickMemory(), ResourceLimitError, _ExtentPacket::right, _Image::rows, SafeMargin, ScaleCharToQuantum(), ScaleQuantumToChar(), SegmentImageTag, SetImageProgress(), _Image::signature, Tau, ThrowMagickException(), and TraceEvent.
| static void InitializeHistogram | ( | const Image * | image, | |
| ssize_t ** | histogram, | |||
| ExceptionInfo * | exception | |||
| ) |
References Blue, _Image::columns, GetPixelBlue(), GetPixelChannels(), GetPixelGreen(), GetPixelRed(), GetVirtualPixels(), Green, Red, _Image::rows, and ScaleQuantumToChar().
Referenced by GetImageDynamicThreshold(), and SegmentImage().
| static IntervalTree* InitializeIntervalTree | ( | const ZeroCrossing * | zero_crossing, | |
| const size_t | number_crossings | |||
| ) | [static] |
References AcquireCriticalMemory(), AcquireQuantumMemory(), _IntervalTree::child, FreeNodes(), InitializeList(), _IntervalTree::left, _IntervalTree::mean_stability, MeanStability(), RelinquishMagickMemory(), _IntervalTree::right, _IntervalTree::sibling, Stability(), _IntervalTree::stability, _ZeroCrossing::tau, _IntervalTree::tau, and TreeLength.
Referenced by OptimalTau().
| static void InitializeList | ( | IntervalTree ** | list, | |
| ssize_t * | number_nodes, | |||
| IntervalTree * | node | |||
| ) | [static] |
References _IntervalTree::child, and _IntervalTree::sibling.
Referenced by InitializeIntervalTree().
| static void MeanStability | ( | IntervalTree * | node | ) | [static] |
References _IntervalTree::child, _IntervalTree::mean_stability, _IntervalTree::sibling, and _IntervalTree::stability.
Referenced by InitializeIntervalTree().
| static double OptimalTau | ( | const ssize_t * | histogram, | |
| const double | max_tau, | |||
| const double | min_tau, | |||
| const double | delta_tau, | |||
| const double | smooth_threshold, | |||
| short * | extrema | |||
| ) | [static] |
References AcquireCriticalMemory(), AcquireQuantumMemory(), ActiveNodes(), _IntervalTree::child, ConsolidateCrossings(), _ZeroCrossing::crossings, DerivativeHistogram(), FreeNodes(), _ZeroCrossing::histogram, InitializeIntervalTree(), _IntervalTree::left, MagickFalse, MagickTrue, PerceptibleReciprocal(), RelinquishMagickMemory(), _IntervalTree::right, ScaleSpace(), _IntervalTree::tau, _ZeroCrossing::tau, TreeLength, and ZeroCrossHistogram().
Referenced by GetImageDynamicThreshold(), and SegmentImage().
| static void ScaleSpace | ( | const ssize_t * | histogram, | |
| const double | tau, | |||
| double * | scale_histogram | |||
| ) |
References AcquireQuantumMemory(), MagickAbsoluteValue, MagickEpsilon, MagickPI, PerceptibleReciprocal(), RelinquishMagickMemory(), ResourceLimitFatalError, and ThrowFatalException.
Referenced by OptimalTau().
| MagickExport MagickBooleanType SegmentImage | ( | Image * | image, | |
| const ColorspaceType | colorspace, | |||
| const MagickBooleanType | verbose, | |||
| const double | cluster_threshold, | |||
| const double | smooth_threshold, | |||
| ExceptionInfo * | exception | |||
| ) |
References AcquireQuantumMemory(), Blue, Classify(), _Image::colorspace, _Image::debug, DeltaTau, _Image::filename, GetMagickModule, Green, InitializeHistogram(), LogMagickEvent(), MagickCoreSignature, MagickFalse, MaxDimension, OptimalTau(), Red, RelinquishMagickMemory(), ResourceLimitError, _Image::signature, Tau, ThrowBinaryException, TraceEvent, TransformImageColorspace(), and WeightingExponent.
Referenced by PreviewImage().
| static void Stability | ( | IntervalTree * | node | ) | [static] |
References _IntervalTree::child, _IntervalTree::sibling, _IntervalTree::stability, and _IntervalTree::tau.
Referenced by InitializeIntervalTree().
| static void ZeroCrossHistogram | ( | double * | second_derivative, | |
| const double | smooth_threshold, | |||
| short * | crossings | |||
| ) |
Referenced by OptimalTau().
const int Blue = 2 [static] |
Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().
const int Green = 1 [static] |
Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().
const int Red = 0 [static] |
Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().
const int SafeMargin = 3 [static] |
Referenced by Classify(), and GetImageDynamicThreshold().
const int TreeLength = 600 [static] |
Referenced by InitializeIntervalTree(), and OptimalTau().
1.6.1