|
MagickCore
6.7.5
|
#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/monitor.h"#include "MagickCore/monitor-private.h"#include "MagickCore/pixel-accessor.h"#include "MagickCore/quantize.h"#include "MagickCore/quantum.h"#include "MagickCore/quantum-private.h"#include "MagickCore/segment.h"#include "MagickCore/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 ssize_t *, const double, const double, const double, const double, short *) |
| static ssize_t | DefineRegion (const short *, ExtentPacket *) |
| static void | InitializeHistogram (const Image *, ssize_t **, ExceptionInfo *) |
| static void | ScaleSpace (const ssize_t *, 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, ExceptionInfo *exception) |
| static ssize_t | MagickAbsoluteValue (const ssize_t x) |
| static ssize_t | MagickMax (const ssize_t x, const ssize_t y) |
| static ssize_t | MagickMin (const ssize_t x, const ssize_t y) |
| static void | ConsolidateCrossings (ZeroCrossing *zero_crossing, const size_t number_crossings) |
| static void | DerivativeHistogram (const MagickRealType *histogram, MagickRealType *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) |
| static void | FreeNodes (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 |
Definition at line 109 of file segment.c.
Referenced by GetImageDynamicThreshold(), and SegmentImage().
| #define MaxDimension 3 |
Definition at line 108 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 115 of file segment.c.
Referenced by Classify().
| #define Tau 5.2f |
Definition at line 117 of file segment.c.
Referenced by GetImageDynamicThreshold(), and SegmentImage().
| #define WeightingExponent 2.5 |
Definition at line 114 of file segment.c.
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] |
Definition at line 1479 of file segment.c.
References _IntervalTree::stability, _IntervalTree::mean_stability, _IntervalTree::sibling, and _IntervalTree::child.
Referenced by OptimalTau().
| static MagickBooleanType Classify | ( | Image * | image, |
| short ** | extrema, | ||
| const MagickRealType | cluster_threshold, | ||
| const MagickRealType | weighting_exponent, | ||
| const MagickBooleanType | verbose, | ||
| ExceptionInfo * | exception | ||
| ) | [static] |
Definition at line 243 of file segment.c.
References ResetMagickMemory(), DefineRegion(), Red, _ExtentPacket::index, Green, Blue, _Cluster::next, AcquireMagickMemory(), ThrowBinaryException, ResourceLimitError, _Image::filename, _Cluster::count, _Cluster::red, _Cluster::green, _Cluster::blue, MagickTrue, AcquireCacheView(), _Image::rows, GetCacheViewVirtualPixels(), _Image::columns, GetPixelRed(), _ExtentPacket::left, SafeMargin, _ExtentPacket::right, GetPixelGreen(), GetPixelBlue(), _ExtentPacket::center, GetPixelChannels(), _Image::progress_monitor, SetImageProgress(), SegmentImageTag, MagickFalse, DestroyCacheView(), _Cluster::id, RelinquishMagickMemory(), FormatLocaleFile(), MaxDimension, ImageError, AcquireQuantumMemory(), AcquireImageColormap(), _Image::colormap, _PixelInfo::red, _PixelInfo::green, _PixelInfo::blue, GetCacheViewAuthenticPixels(), SetPixelIndex(), _Image::colors, SegmentPower, SyncCacheViewAuthenticPixels(), and SyncImage().
Referenced by SegmentImage().
| static void ConsolidateCrossings | ( | ZeroCrossing * | zero_crossing, |
| const size_t | number_crossings | ||
| ) | [static] |
Definition at line 717 of file segment.c.
References MagickMax(), MagickMin(), and _ZeroCrossing::crossings.
Referenced by OptimalTau().
| static ssize_t DefineRegion | ( | const short * | extrema, |
| ExtentPacket * | extents | ||
| ) | [static] |
Definition at line 834 of file segment.c.
References _ExtentPacket::left, _ExtentPacket::center, _ExtentPacket::right, _ExtentPacket::index, MagickFalse, and MagickTrue.
Referenced by Classify(), and GetImageDynamicThreshold().
| static void DerivativeHistogram | ( | const MagickRealType * | histogram, |
| MagickRealType * | derivative | ||
| ) | [static] |
Definition at line 890 of file segment.c.
Referenced by OptimalTau().
| static void FreeNodes | ( | IntervalTree * | node | ) | [static] |
Definition at line 1496 of file segment.c.
References _IntervalTree::sibling, _IntervalTree::child, and RelinquishMagickMemory().
Referenced by OptimalTau().
| MagickExport MagickBooleanType GetImageDynamicThreshold | ( | const Image * | image, |
| const double | cluster_threshold, | ||
| const double | smooth_threshold, | ||
| PixelInfo * | pixel, | ||
| ExceptionInfo * | exception | ||
| ) |
Definition at line 947 of file segment.c.
References MaxDimension, _Image::signature, MagickSignature, _Image::debug, MagickFalse, LogMagickEvent(), TraceEvent, GetMagickModule, _Image::filename, GetPixelInfo(), AcquireQuantumMemory(), RelinquishMagickMemory(), ThrowMagickException(), ResourceLimitError, InitializeHistogram(), OptimalTau(), Red, Tau, DeltaTau, Green, Blue, ResetMagickMemory(), DefineRegion(), _ExtentPacket::index, _Cluster::next, AcquireMagickMemory(), _Cluster::count, _Cluster::red, _Cluster::green, _Cluster::blue, _Image::rows, GetVirtualPixels(), _Image::columns, GetPixelRed(), _ExtentPacket::left, SafeMargin, _ExtentPacket::right, GetPixelGreen(), GetPixelBlue(), _ExtentPacket::center, GetPixelChannels(), SetImageProgress(), SegmentImageTag, _Cluster::id, _PixelInfo::red, _PixelInfo::green, _PixelInfo::blue, and MagickTrue.
| static void InitializeHistogram | ( | const Image * | image, |
| ssize_t ** | histogram, | ||
| ExceptionInfo * | exception | ||
| ) | [static] |
Definition at line 1236 of file segment.c.
References Red, Green, Blue, _Image::rows, GetVirtualPixels(), _Image::columns, GetPixelRed(), GetPixelGreen(), GetPixelBlue(), and GetPixelChannels().
Referenced by GetImageDynamicThreshold(), and SegmentImage().
| static IntervalTree* InitializeIntervalTree | ( | const ZeroCrossing * | zero_crossing, |
| const size_t | number_crossings | ||
| ) | [static] |
Definition at line 1354 of file segment.c.
References AcquireQuantumMemory(), TreeLength, AcquireMagickMemory(), _IntervalTree::child, _IntervalTree::sibling, _IntervalTree::tau, _IntervalTree::left, _IntervalTree::right, InitializeList(), _ZeroCrossing::tau, Stability(), MeanStability(), and RelinquishMagickMemory().
Referenced by OptimalTau().
| static void InitializeList | ( | IntervalTree ** | list, |
| ssize_t * | number_nodes, | ||
| IntervalTree * | node | ||
| ) | [static] |
Definition at line 1301 of file segment.c.
References _IntervalTree::child, and _IntervalTree::sibling.
Referenced by InitializeIntervalTree().
| static ssize_t MagickAbsoluteValue | ( | const ssize_t | x | ) | [inline, static] |
Definition at line 696 of file segment.c.
Referenced by ScaleSpace().
| static ssize_t MagickMax | ( | const ssize_t | x, |
| const ssize_t | y | ||
| ) | [inline, static] |
Definition at line 703 of file segment.c.
Referenced by ConsolidateCrossings().
| static ssize_t MagickMin | ( | const ssize_t | x, |
| const ssize_t | y | ||
| ) | [inline, static] |
Definition at line 710 of file segment.c.
Referenced by ConsolidateCrossings().
| static void MeanStability | ( | IntervalTree * | node | ) | [static] |
Definition at line 1312 of file segment.c.
References _IntervalTree::mean_stability, _IntervalTree::child, _IntervalTree::sibling, and _IntervalTree::stability.
Referenced by InitializeIntervalTree().
| static MagickRealType OptimalTau | ( | const ssize_t * | histogram, |
| const double | max_tau, | ||
| const double | min_tau, | ||
| const double | delta_tau, | ||
| const double | smooth_threshold, | ||
| short * | extrema | ||
| ) | [static] |
Definition at line 1505 of file segment.c.
References AcquireQuantumMemory(), TreeLength, ThrowFatalException, ResourceLimitFatalError, _ZeroCrossing::tau, ScaleSpace(), DerivativeHistogram(), ZeroCrossHistogram(), RelinquishMagickMemory(), ConsolidateCrossings(), _ZeroCrossing::crossings, InitializeIntervalTree(), ActiveNodes(), _IntervalTree::child, _IntervalTree::tau, _IntervalTree::right, MagickTrue, MagickFalse, _IntervalTree::left, _ZeroCrossing::histogram, and FreeNodes().
Referenced by GetImageDynamicThreshold(), and SegmentImage().
| static void ScaleSpace | ( | const ssize_t * | histogram, |
| const MagickRealType | tau, | ||
| MagickRealType * | scale_histogram | ||
| ) |
Definition at line 1713 of file segment.c.
References AcquireQuantumMemory(), ThrowFatalException, ResourceLimitFatalError, MagickPI, MagickEpsilon, MagickAbsoluteValue(), and RelinquishMagickMemory().
Referenced by OptimalTau().
| MagickExport MagickBooleanType SegmentImage | ( | Image * | image, |
| const ColorspaceType | colorspace, | ||
| const MagickBooleanType | verbose, | ||
| const double | cluster_threshold, | ||
| const double | smooth_threshold, | ||
| ExceptionInfo * | exception | ||
| ) |
Definition at line 1792 of file segment.c.
References MaxDimension, _Image::signature, MagickSignature, _Image::debug, MagickFalse, LogMagickEvent(), TraceEvent, GetMagickModule, _Image::filename, AcquireQuantumMemory(), RelinquishMagickMemory(), ThrowBinaryException, ResourceLimitError, IsRGBColorspace(), TransformImageColorspace(), InitializeHistogram(), OptimalTau(), Red, Tau, DeltaTau, Green, Blue, Classify(), and WeightingExponent.
Referenced by PreviewImage().
| static void Stability | ( | IntervalTree * | node | ) | [static] |
Definition at line 1342 of file segment.c.
References _IntervalTree::child, _IntervalTree::stability, _IntervalTree::tau, and _IntervalTree::sibling.
Referenced by InitializeIntervalTree().
| static void ZeroCrossHistogram | ( | MagickRealType * | second_derivative, |
| const MagickRealType | smooth_threshold, | ||
| short * | crossings | ||
| ) |
Definition at line 1891 of file segment.c.
Referenced by OptimalTau().
const int Blue = 2 [static] |
Definition at line 180 of file segment.c.
Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().
| const int Green = 1 |
Definition at line 181 of file segment.c.
Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().
| const int Red = 0 |
Definition at line 182 of file segment.c.
Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().
| const int SafeMargin = 3 |
Definition at line 183 of file segment.c.
Referenced by Classify(), and GetImageDynamicThreshold().
| const int TreeLength = 600 |
Definition at line 184 of file segment.c.
Referenced by InitializeIntervalTree(), and OptimalTau().