MagickCore  6.9.11
segment.c File Reference
Include dependency graph for segment.c:

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 MagickRealType 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 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 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, MagickPixelPacket *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 IntervalTreeInitializeIntervalTree (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)
 

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
 

Macro Definition Documentation

◆ DeltaTau

#define DeltaTau   0.5f

Definition at line 111 of file segment.c.

Referenced by GetImageDynamicThreshold(), and SegmentImage().

◆ MaxDimension

#define MaxDimension   3

Definition at line 110 of file segment.c.

Referenced by Classify(), GetImageDynamicThreshold(), and SegmentImage().

◆ SegmentImageTag

#define SegmentImageTag   "Segment/Image"

◆ SegmentPower

#define SegmentPower (   ratio)    pow(ratio,(double) (1.0/(weighting_exponent-1.0)));

Definition at line 117 of file segment.c.

Referenced by Classify().

◆ Tau

#define Tau   5.2f

Definition at line 119 of file segment.c.

Referenced by GetImageDynamicThreshold(), and SegmentImage().

◆ ThrowClassifyException

#define ThrowClassifyException (   severity,
  tag,
  label 
)
Value:
{\
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); \
}
MagickExport void * RelinquishMagickMemory(void *memory)
Definition: memory.c:1122

Referenced by Classify().

◆ WeightingExponent

#define WeightingExponent   2.5

Definition at line 116 of file segment.c.

Referenced by SegmentImage().

Typedef Documentation

◆ Cluster

typedef struct _Cluster Cluster

◆ ExtentPacket

typedef struct _ExtentPacket ExtentPacket

◆ IntervalTree

typedef struct _IntervalTree IntervalTree

◆ ZeroCrossing

typedef struct _ZeroCrossing ZeroCrossing

Function Documentation

◆ ActiveNodes()

static void ActiveNodes ( IntervalTree **  list,
ssize_t *  number_nodes,
IntervalTree node 
)
static

◆ Classify()

◆ ConsolidateCrossings()

static void ConsolidateCrossings ( ZeroCrossing zero_crossing,
const size_t  number_crossings 
)
static

Definition at line 717 of file segment.c.

References _ZeroCrossing::crossings, MagickMax, and MagickMin.

Referenced by OptimalTau().

◆ DefineRegion()

static ssize_t DefineRegion ( const short *  extrema,
ExtentPacket extents 
)
static

◆ DerivativeHistogram()

static void DerivativeHistogram ( const MagickRealType histogram,
MagickRealType derivative 
)
static

Definition at line 890 of file segment.c.

Referenced by OptimalTau().

◆ FreeNodes()

static void FreeNodes ( IntervalTree node)
static

◆ GetImageDynamicThreshold()

◆ InitializeHistogram()

static void InitializeHistogram ( const Image image,
ssize_t **  histogram,
ExceptionInfo exception 
)

◆ InitializeIntervalTree()

◆ InitializeList()

static void InitializeList ( IntervalTree **  list,
ssize_t *  number_nodes,
IntervalTree node 
)
static

Definition at line 1304 of file segment.c.

References _IntervalTree::child, and _IntervalTree::sibling.

Referenced by InitializeIntervalTree().

◆ MeanStability()

static void MeanStability ( IntervalTree node)
static

◆ OptimalTau()

◆ ScaleSpace()

static void ScaleSpace ( const ssize_t *  histogram,
const MagickRealType  tau,
MagickRealType scale_histogram 
)

◆ SegmentImage()

◆ Stability()

static void Stability ( IntervalTree node)
static

◆ ZeroCrossHistogram()

static void ZeroCrossHistogram ( MagickRealType second_derivative,
const MagickRealType  smooth_threshold,
short *  crossings 
)

Definition at line 1908 of file segment.c.

Referenced by OptimalTau().

Variable Documentation

◆ Blue

const int Blue = 2
static

Definition at line 182 of file segment.c.

Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().

◆ Green

const int Green = 1
static

Definition at line 183 of file segment.c.

Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().

◆ Red

const int Red = 0
static

Definition at line 184 of file segment.c.

Referenced by Classify(), GetImageDynamicThreshold(), InitializeHistogram(), and SegmentImage().

◆ SafeMargin

const int SafeMargin = 3
static

Definition at line 185 of file segment.c.

Referenced by Classify(), and GetImageDynamicThreshold().

◆ TreeLength

const int TreeLength = 600
static

Definition at line 186 of file segment.c.

Referenced by InitializeIntervalTree(), and OptimalTau().