GraphicsMagick Search site

- Home
- License
- Mission
- Download
- Installation
- FAQ
- News
- Formats

- Process
- Contribute
- CVS
- Mailing Lists
- ChangeLog
- Report Bugs
- Utilities
- Programming
- Links

# segment

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

Contents

- SegmentImage

# SegmentImage

## Synopsis

    unsigned int 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:

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

colors:
  The SegmentImage function returns this integer value. It is the actual number of colors allocated in the colormap.
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.