NAME
fuzzyc_segment - image segmentation based on fuzzy c-means
SYNOPSIS
#include "CVIPtoolkit.h"
#include "fuzzyc.h"
#include "CVIPdef.h"
Image *fuzzyc_segment(Image *srcImage, float variance)
<srcImage> - pointer to Image structure
<variance> - value for Gaussian kernal variance
PATH
$CVIPHOME/SEGMENTATION/fuzzyc.c
DESCRIPTION
Color image segmentation based on thresholding and the fuzzy
c-means can be divided into two stages: coarse and fine seg-
mentation. The coarse segmentation is intended to reduce
the computational burden required for the fine segmentation
- the fuzzy c-means. In coarse segmentation, a scale-space
filter is used to analyze the histograms of the three color
components. It determines the number of valid classes and
assigns classified pixels to these classes according to the
threshold value (safety margins). The fine segmentation
uses fuzzy c-means to assign the remaining unclassified pix-
els to their closest class. Histogram analysis using the
scale-space filter in coarse segmentation stage is a tech-
nique that involves generating a multiscale description of
histogram by convolving it with a series of Gaussians of
gradually increasing width, and marking the location and
direction of the sign change of zero-crossing in its second
derivatives. The parameter (x, tau)-space is known to be
the scale-space where tau is the scale constant. The scale
constant tau is inversely proportional to the number of
peaks and valleys that can be extracted from the histograms.
The importance of this fact is that if prior knowledge is
known about a particular type of image, tau can be set to be
a constant to obtain the desired number of peaks and
values, and the process can be made unsupervised. The tau
value that will give satisfactory result in most of the
color space used in an experiment is 5. After histogram
analysis, valid classes will be determined according to
the safety margin (Usually 5% - 20%) specified by user.
Classified pixels will be assigned to their valid classes,
and the other pixels will be tagged as unclassified. In
this implementation, they will appear as white pixels (255)
on the image. The larger the safety margin, the more accu-
rate the result of the segmentation will be, and the
more computational efforts it will need when using the
fuzzy c-means in fine stage. In fine segmentation stage,
the fuzzy membership of the unclassified pixels will be cal-
culated and assigned to the class where they have the max-
imum membership value. The last parameter the user has to
decide when using the program is the display color of the
result image. The user has the option of using the means
value for each valid class or the predefined colors for the
segmented regions.
TYPES AND CONSTANTS
RETURN VALUES
Pointer to an Image structure on success, and NULL pointer
on failure.
EXAMPLE
#include "CVIPtoolkit.h"
#include "CVIPdef.h"
#include "CVIPconvert.h"
#include "fuzzyc.h"
void main()
{
Image *cvipImage;
IMAGE_FORMAT format;
char *inputfile, *outputfile;
setDisplay_Image("picture", "Default");
print_CVIP("\n\t\tEnter the Input File Name: ");
inputfile =(char *) getString_CVIP();
format = getFormat_CVIP(inputfile);
cvipImage = read_Image(inputfile, 1);
view_Image(cvipImage, inputfile);
cvipImage = (Image *) fuzzyc_segment(cvipImage, 4.0);
/* Four color example */
print_CVIP("\n\t\tEnter the Output File Name: ");
outputfile = getString_CVIP();
view_Image(cvipImage, outputfile);
write_Image(cvipImage,outputfile,CVIP_NO,CVIP_NO,format,1);
free(inputfile);
free(outputfile);
}
BUGS
None at this time
SEE ALSO
libsegment
AUTHOR
Copyright (C) 1995 SIUE - by Scott Umbaugh and Greg Hance.