% MagickCore Methods to Segment an Image with Thresholding Fuzzy c-Means %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% April 1993 %
% %
% %
cluster=cluster->next;
}
}
- threshold=(background->red.center+object->red.center)/2.0;
- pixel->red=(double) ScaleCharToQuantum((unsigned char)
- (threshold+0.5));
- threshold=(background->green.center+object->green.center)/2.0;
- pixel->green=(double) ScaleCharToQuantum((unsigned char)
- (threshold+0.5));
- threshold=(background->blue.center+object->blue.center)/2.0;
- pixel->blue=(double) ScaleCharToQuantum((unsigned char)
- (threshold+0.5));
+ if (background != (Cluster *) NULL)
+ {
+ threshold=(background->red.center+object->red.center)/2.0;
+ pixel->red=(double) ScaleCharToQuantum((unsigned char)
+ (threshold+0.5));
+ threshold=(background->green.center+object->green.center)/2.0;
+ pixel->green=(double) ScaleCharToQuantum((unsigned char)
+ (threshold+0.5));
+ threshold=(background->blue.center+object->blue.center)/2.0;
+ pixel->blue=(double) ScaleCharToQuantum((unsigned char)
+ (threshold+0.5));
+ }
/*
Relinquish resources.
*/