segment

Segment and image with thresholding using the fuzzy c-means method

Contents

SegmentImage

Synopsis

MagickPassFail SegmentImage( Image *image, const ColorspaceType colorspace,
                             const unsigned int verbose, const double cluster_threshold,
                             const double smoothing_threshold );

Description

Method SegmentImage segment an image by analyzing the histograms of the color components and identifying units that are homogeneous with the fuzzy c-means technique.

Specify cluster threshold as the number of pixels in each cluster must exceed the the cluster threshold to be considered valid. Smoothing threshold eliminates noise in the second derivative of the histogram. As the value is increased, you can expect a smoother second derivative. The default is 1.5.

The format of the SegmentImage method is:

MagickPassFail SegmentImage( Image *image, const ColorspaceType colorspace,
                             const unsigned int verbose, const double cluster_threshold,
                             const double smoothing_threshold );
image:
Specifies a pointer to an Image structure; returned from ReadImage.
colorspace:
An unsigned integer value that indicates the colorspace. Empirical evidence suggests that distances in YUV or YIQ correspond to perceptual color differences more closely than do distances in RGB space. The image is then returned to RGB colorspace after color reduction.
verbose:
A value greater than zero prints detailed information about the identified classes.
cluster_threshold:
The minimum number of total pixels contained in a hexahedra before it can be considered valid (expressed as a percentage of total pixels). This is used to eliminate seldom used colors.
smoothing_threshold:
If the absolute value of a second derivative point is less than smoothing_threshold then that derivative point is ignored (i.e. set to 0) while evaluating zero crossings. This causes small variations (could be noise) to be ignored.