MagickCore 7.1.0
Convert, Edit, Or Compose Bitmap Images
|
#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/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"
Go to the source code of this file.
Data Structures | |
struct | _ExtentPacket |
struct | _Cluster |
struct | _IntervalTree |
struct | _ZeroCrossing |
Macros | |
#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 SegmentImageTag "Segment/Image" |
#define SegmentPower | ( | ratio | ) | pow(ratio,(double) (1.0/(weighting_exponent-1.0))); |
#define ThrowClassifyException | ( | severity, | |
tag, | |||
label | |||
) |
typedef struct _ExtentPacket ExtentPacket |
typedef struct _IntervalTree IntervalTree |
typedef struct _ZeroCrossing ZeroCrossing |
|
static |
Definition at line 1482 of file segment.c.
References ActiveNodes(), _IntervalTree::child, _IntervalTree::mean_stability, _IntervalTree::sibling, and _IntervalTree::stability.
Referenced by ActiveNodes(), and OptimalTau().
|
static |
Definition at line 246 of file segment.c.
References AcquireAuthenticCacheView(), AcquireImageColormap(), AcquireQuantumMemory(), AcquireVirtualCacheView(), _PixelInfo::blue, _Cluster::blue, Blue, _ExtentPacket::center, _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, SegmentImageTag, SegmentPower, SetImageProgress(), SetPixelIndex(), SyncCacheViewAuthenticPixels(), SyncImage(), and ThrowClassifyException.
Referenced by SegmentImage().
|
static |
Definition at line 703 of file segment.c.
References _ZeroCrossing::crossings, MagickMax, and MagickMin.
Referenced by OptimalTau().
|
static |
Definition at line 820 of file segment.c.
References _ExtentPacket::center, _ExtentPacket::index, _ExtentPacket::left, MagickFalse, MagickTrue, and _ExtentPacket::right.
Referenced by Classify(), and GetImageDynamicThreshold().
|
static |
Definition at line 876 of file segment.c.
Referenced by OptimalTau().
|
static |
Definition at line 1499 of file segment.c.
References _IntervalTree::child, FreeNodes(), RelinquishMagickMemory(), and _IntervalTree::sibling.
Referenced by FreeNodes(), InitializeIntervalTree(), and OptimalTau().
MagickExport MagickBooleanType GetImageDynamicThreshold | ( | const Image * | image, |
const double | cluster_threshold, | ||
const double | smooth_threshold, | ||
PixelInfo * | pixel, | ||
ExceptionInfo * | exception | ||
) |
Definition at line 933 of file segment.c.
References AcquireQuantumMemory(), _PixelInfo::blue, _Cluster::blue, Blue, _ExtentPacket::center, _Image::columns, _Cluster::count, DefineRegion(), DeltaTau, _Image::filename, GetMagickModule, GetPixelBlue(), GetPixelChannels(), GetPixelGreen(), GetPixelInfo(), GetPixelRed(), GetVirtualPixels(), _PixelInfo::green, _Cluster::green, Green, _Cluster::id, _ExtentPacket::index, InitializeHistogram(), IsEventLogging(), _ExtentPacket::left, LogMagickEvent(), MagickCoreSignature, MagickFalse, MagickTrue, MaxDimension, _Cluster::next, OptimalTau(), _PixelInfo::red, _Cluster::red, Red, RelinquishMagickMemory(), ResourceLimitError, _ExtentPacket::right, _Image::rows, SafeMargin, SegmentImageTag, SetImageProgress(), _Image::signature, Tau, ThrowMagickException(), and TraceEvent.
static void InitializeHistogram | ( | const Image * | image, |
ssize_t ** | histogram, | ||
ExceptionInfo * | exception | ||
) |
Definition at line 1224 of file segment.c.
References Blue, _Image::columns, GetPixelBlue(), GetPixelChannels(), GetPixelGreen(), GetPixelRed(), GetVirtualPixels(), Green, Red, and _Image::rows.
Referenced by GetImageDynamicThreshold(), and SegmentImage().
|
static |
Definition at line 1342 of file segment.c.
References AcquireCriticalMemory(), AcquireQuantumMemory(), _IntervalTree::child, FreeNodes(), InitializeList(), _IntervalTree::left, _IntervalTree::mean_stability, MeanStability(), RelinquishMagickMemory(), _IntervalTree::right, _IntervalTree::sibling, _IntervalTree::stability, Stability(), _IntervalTree::tau, _ZeroCrossing::tau, and TreeLength.
Referenced by OptimalTau().
|
static |
Definition at line 1289 of file segment.c.
References _IntervalTree::child, InitializeList(), and _IntervalTree::sibling.
Referenced by InitializeIntervalTree(), and InitializeList().
|
static |
Definition at line 1300 of file segment.c.
References _IntervalTree::child, _IntervalTree::mean_stability, MeanStability(), _IntervalTree::sibling, and _IntervalTree::stability.
Referenced by InitializeIntervalTree(), and MeanStability().
|
static |
Definition at line 1508 of file segment.c.
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 | ||
) |
Definition at line 1717 of file segment.c.
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 | ||
) |
Definition at line 1795 of file segment.c.
References AcquireQuantumMemory(), Blue, Classify(), _Image::colorspace, DeltaTau, _Image::filename, GetMagickModule, Green, InitializeHistogram(), IsEventLogging(), LogMagickEvent(), MagickCoreSignature, MagickFalse, MaxDimension, OptimalTau(), Red, RelinquishMagickMemory(), ResourceLimitError, _Image::signature, Tau, ThrowBinaryException, TraceEvent, TransformImageColorspace(), and WeightingExponent.
Referenced by PreviewImage().
|
static |
Definition at line 1330 of file segment.c.
References _IntervalTree::child, _IntervalTree::sibling, _IntervalTree::stability, Stability(), and _IntervalTree::tau.
Referenced by InitializeIntervalTree(), and Stability().
static void ZeroCrossHistogram | ( | double * | second_derivative, |
const double | smooth_threshold, | ||
short * | crossings | ||
) |
Definition at line 1896 of file segment.c.
Referenced by OptimalTau().
|
static |
Definition at line 183 of file segment.c.
Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().
|
static |
Definition at line 184 of file segment.c.
Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().
|
static |
Definition at line 185 of file segment.c.
Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().
|
static |
Definition at line 186 of file segment.c.
Referenced by Classify(), and GetImageDynamicThreshold().
|
static |
Definition at line 187 of file segment.c.
Referenced by InitializeIntervalTree(), and OptimalTau().