#include "magick/studio.h"#include "magick/cache.h"#include "magick/color.h"#include "magick/colorspace.h"#include "magick/exception.h"#include "magick/exception-private.h"#include "magick/image.h"#include "magick/image-private.h"#include "magick/memory_.h"#include "magick/monitor.h"#include "magick/monitor-private.h"#include "magick/quantize.h"#include "magick/quantum.h"#include "magick/quantum-private.h"#include "magick/segment.h"#include "magick/string_.h"
Go to the source code of this file.
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" |
Typedefs | |
| typedef struct _ExtentPacket | ExtentPacket |
| typedef struct _Cluster | Cluster |
| typedef struct _IntervalTree | IntervalTree |
| typedef struct _ZeroCrossing | ZeroCrossing |
Functions | |
| static MagickRealType | OptimalTau (const long *, const double, const double, const double, const double, short *) |
| static long | DefineRegion (const short *, ExtentPacket *) |
| static void | InitializeHistogram (const Image *, long **, ExceptionInfo *) |
| static void | ScaleSpace (const long *, const MagickRealType, MagickRealType *) |
| static void | ZeroCrossHistogram (MagickRealType *, const MagickRealType, short *) |
| static MagickBooleanType | Classify (Image *image, short **extrema, const MagickRealType cluster_threshold, const MagickRealType weighting_exponent, const MagickBooleanType verbose) |
| static long | MagickAbsoluteValue (const long x) |
| static long | MagickMax (const long x, const long y) |
| static long | MagickMin (const long x, const long y) |
| static void | ConsolidateCrossings (ZeroCrossing *zero_crossing, const unsigned long number_crossings) |
| static void | DerivativeHistogram (const MagickRealType *histogram, MagickRealType *derivative) |
| MagickExport MagickBooleanType | GetImageDynamicThreshold (const Image *image, const double cluster_threshold, const double smooth_threshold, MagickPixelPacket *pixel, ExceptionInfo *exception) |
| static void | InitializeList (IntervalTree **list, long *number_nodes, IntervalTree *node) |
| static void | MeanStability (IntervalTree *node) |
| static void | Stability (IntervalTree *node) |
| static IntervalTree * | InitializeIntervalTree (const ZeroCrossing *zero_crossing, const unsigned long number_crossings) |
| static void | ActiveNodes (IntervalTree **list, long *number_nodes, IntervalTree *node) |
| static void | FreeNodes (IntervalTree *node) |
| MagickExport MagickBooleanType | SegmentImage (Image *image, const ColorspaceType colorspace, const MagickBooleanType verbose, const double cluster_threshold, const double smooth_threshold) |
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 |
Definition at line 106 of file segment.c.
Referenced by GetImageDynamicThreshold(), and SegmentImage().
| #define MaxDimension 3 |
Definition at line 105 of file segment.c.
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))); |
Definition at line 112 of file segment.c.
Referenced by Classify().
| #define Tau 5.2f |
Definition at line 114 of file segment.c.
Referenced by GetImageDynamicThreshold(), and SegmentImage().
| #define WeightingExponent 2.5 |
Definition at line 111 of file segment.c.
Referenced by SegmentImage().
| typedef struct _ExtentPacket ExtentPacket |
| typedef struct _IntervalTree IntervalTree |
| typedef struct _ZeroCrossing ZeroCrossing |
| static void ActiveNodes | ( | IntervalTree ** | list, | |
| long * | number_nodes, | |||
| IntervalTree * | node | |||
| ) | [static] |
Definition at line 1470 of file segment.c.
References _IntervalTree::child, _IntervalTree::mean_stability, _IntervalTree::sibling, and _IntervalTree::stability.
Referenced by OptimalTau().
| static MagickBooleanType Classify | ( | Image * | image, | |
| short ** | extrema, | |||
| const MagickRealType | cluster_threshold, | |||
| const MagickRealType | weighting_exponent, | |||
| const MagickBooleanType | verbose | |||
| ) | [static] |
Definition at line 238 of file segment.c.
References AcquireCacheView(), AcquireImageColormap(), AcquireMagickMemory(), AcquireQuantumMemory(), _PixelPacket::blue, _Cluster::blue, Blue, _ExtentPacket::center, _Image::colormap, _Image::colors, _Image::columns, _Cluster::count, DefineRegion(), DestroyCacheView(), _Image::exception, _Image::filename, GetCacheViewAuthenticIndexQueue(), GetCacheViewAuthenticPixels(), GetCacheViewVirtualPixels(), _PixelPacket::green, _Cluster::green, Green, _Cluster::id, ImageError, _ExtentPacket::index, _ExtentPacket::left, MagickFalse, MagickTrue, MaxDimension, _Cluster::next, _Image::progress_monitor, _PixelPacket::red, _Cluster::red, Red, RelinquishMagickMemory(), ResetMagickMemory(), ResourceLimitError, _ExtentPacket::right, _Image::rows, SafeMargin, ScaleCharToQuantum(), ScaleQuantumToChar(), SegmentImageTag, SegmentPower, SetImageProgress(), SyncCacheViewAuthenticPixels(), SyncImage(), and ThrowBinaryException.
Referenced by SegmentImage().
| static void ConsolidateCrossings | ( | ZeroCrossing * | zero_crossing, | |
| const unsigned long | number_crossings | |||
| ) | [static] |
Definition at line 709 of file segment.c.
References _ZeroCrossing::crossings, MagickMax(), and MagickMin().
Referenced by OptimalTau().
| static long DefineRegion | ( | const short * | extrema, | |
| ExtentPacket * | extents | |||
| ) | [static] |
Definition at line 826 of file segment.c.
References _ExtentPacket::center, _ExtentPacket::index, _ExtentPacket::left, MagickFalse, MagickTrue, and _ExtentPacket::right.
Referenced by Classify(), and GetImageDynamicThreshold().
| static void DerivativeHistogram | ( | const MagickRealType * | histogram, | |
| MagickRealType * | derivative | |||
| ) | [static] |
Definition at line 882 of file segment.c.
Referenced by OptimalTau().
| static void FreeNodes | ( | IntervalTree * | node | ) | [static] |
Definition at line 1487 of file segment.c.
References _IntervalTree::child, RelinquishMagickMemory(), and _IntervalTree::sibling.
Referenced by OptimalTau().
| MagickExport MagickBooleanType GetImageDynamicThreshold | ( | const Image * | image, | |
| const double | cluster_threshold, | |||
| const double | smooth_threshold, | |||
| MagickPixelPacket * | pixel, | |||
| ExceptionInfo * | exception | |||
| ) |
Definition at line 939 of file segment.c.
References AcquireMagickMemory(), AcquireQuantumMemory(), _MagickPixelPacket::blue, _PixelPacket::blue, _Cluster::blue, Blue, _ExtentPacket::center, _Image::columns, _Cluster::count, _Image::debug, DefineRegion(), DeltaTau, _Image::filename, GetMagickModule, GetMagickPixelPacket(), GetVirtualPixels(), _MagickPixelPacket::green, _PixelPacket::green, _Cluster::green, Green, _Cluster::id, _ExtentPacket::index, InitializeHistogram(), _ExtentPacket::left, LogMagickEvent(), MagickFalse, MagickSignature, MagickTrue, MaxDimension, _Cluster::next, OptimalTau(), _MagickPixelPacket::red, _PixelPacket::red, _Cluster::red, Red, RelinquishMagickMemory(), ResetMagickMemory(), ResourceLimitError, _ExtentPacket::right, _Image::rows, SafeMargin, ScaleCharToQuantum(), ScaleQuantumToChar(), SegmentImageTag, SetImageProgress(), _Image::signature, Tau, ThrowMagickException(), and TraceEvent.
Referenced by ThresholdImageChannel().
| static void InitializeHistogram | ( | const Image * | image, | |
| long ** | histogram, | |||
| ExceptionInfo * | exception | |||
| ) | [static] |
Definition at line 1227 of file segment.c.
References _PixelPacket::blue, Blue, _Image::columns, GetVirtualPixels(), _PixelPacket::green, Green, _PixelPacket::red, Red, _Image::rows, and ScaleQuantumToChar().
Referenced by GetImageDynamicThreshold(), and SegmentImage().
| static IntervalTree* InitializeIntervalTree | ( | const ZeroCrossing * | zero_crossing, | |
| const unsigned long | number_crossings | |||
| ) | [static] |
Definition at line 1345 of file segment.c.
References AcquireMagickMemory(), AcquireQuantumMemory(), _IntervalTree::child, InitializeList(), _IntervalTree::left, MeanStability(), RelinquishMagickMemory(), _IntervalTree::right, _IntervalTree::sibling, Stability(), _ZeroCrossing::tau, _IntervalTree::tau, and TreeLength.
Referenced by OptimalTau().
| static void InitializeList | ( | IntervalTree ** | list, | |
| long * | number_nodes, | |||
| IntervalTree * | node | |||
| ) | [static] |
Definition at line 1292 of file segment.c.
References _IntervalTree::child, and _IntervalTree::sibling.
Referenced by InitializeIntervalTree().
| static long MagickAbsoluteValue | ( | const long | x | ) | [inline, static] |
Definition at line 688 of file segment.c.
Referenced by ScaleSpace().
| static long MagickMax | ( | const long | x, | |
| const long | y | |||
| ) | [inline, static] |
Definition at line 695 of file segment.c.
Referenced by ConsolidateCrossings().
| static long MagickMin | ( | const long | x, | |
| const long | y | |||
| ) | [inline, static] |
Definition at line 702 of file segment.c.
Referenced by ConsolidateCrossings().
| static void MeanStability | ( | IntervalTree * | node | ) | [static] |
Definition at line 1303 of file segment.c.
References _IntervalTree::child, _IntervalTree::mean_stability, _IntervalTree::sibling, and _IntervalTree::stability.
Referenced by InitializeIntervalTree().
| static MagickRealType OptimalTau | ( | const long * | histogram, | |
| const double | max_tau, | |||
| const double | min_tau, | |||
| const double | delta_tau, | |||
| const double | smooth_threshold, | |||
| short * | extrema | |||
| ) | [static] |
Definition at line 1496 of file segment.c.
References AcquireQuantumMemory(), ActiveNodes(), _IntervalTree::child, ConsolidateCrossings(), _ZeroCrossing::crossings, DerivativeHistogram(), FreeNodes(), _ZeroCrossing::histogram, InitializeIntervalTree(), _IntervalTree::left, MagickFalse, MagickTrue, RelinquishMagickMemory(), ResourceLimitFatalError, _IntervalTree::right, ScaleSpace(), _IntervalTree::tau, _ZeroCrossing::tau, ThrowFatalException, TreeLength, and ZeroCrossHistogram().
Referenced by GetImageDynamicThreshold(), and SegmentImage().
| static void ScaleSpace | ( | const long * | histogram, | |
| const MagickRealType | tau, | |||
| MagickRealType * | scale_histogram | |||
| ) |
Definition at line 1704 of file segment.c.
References AcquireQuantumMemory(), MagickAbsoluteValue(), MagickEpsilon, MagickPI, 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 | |||
| ) |
Definition at line 1780 of file segment.c.
References AcquireQuantumMemory(), Blue, Classify(), _Image::debug, DeltaTau, _Image::exception, _Image::filename, GetMagickModule, Green, InitializeHistogram(), LogMagickEvent(), MagickFalse, MagickSignature, MaxDimension, OptimalTau(), Red, RelinquishMagickMemory(), ResourceLimitError, RGBColorspace, _Image::signature, Tau, ThrowBinaryException, TraceEvent, TransformImageColorspace(), and WeightingExponent.
Referenced by PreviewImage().
| static void Stability | ( | IntervalTree * | node | ) | [static] |
Definition at line 1333 of file segment.c.
References _IntervalTree::child, _IntervalTree::sibling, _IntervalTree::stability, and _IntervalTree::tau.
Referenced by InitializeIntervalTree().
| static void ZeroCrossHistogram | ( | MagickRealType * | second_derivative, | |
| const MagickRealType | smooth_threshold, | |||
| short * | crossings | |||
| ) |
Definition at line 1877 of file segment.c.
Referenced by OptimalTau().
const int Blue = 2 [static] |
Definition at line 177 of file segment.c.
Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().
const int Green = 1 [static] |
Definition at line 178 of file segment.c.
Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().
const int Red = 0 [static] |
Definition at line 179 of file segment.c.
Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().
const int SafeMargin = 3 [static] |
Definition at line 180 of file segment.c.
Referenced by Classify(), and GetImageDynamicThreshold().
const int TreeLength = 600 [static] |
Definition at line 181 of file segment.c.
Referenced by InitializeIntervalTree(), and OptimalTau().
1.6.1