COLOR BASED SEGMENTATION
Given a pixel , and the color intensity is defined as the segmentation can be done by calculating the distance from each color vector from a reference background color
the vector can be obtained by a set of training images as the mean of the samples:
and then the segmentation become a classification task where the foreground pixels are the ones in a 3d sphere with center
MAHALANOBIS DISTANCE
A more precise way of making color based segmentation is to consider the covariance also with means, the covariance matrix is obtained in the training phase as follows
The new distance measure is given by the inclusion of the covariance matrix in the euclidean distance
That in the case of a diagonal covariance matrix becomes
The mahalanobis distance weights the differences between the color components unequally (inversely proportional to the learned variances ), This as the effect of lower the consideration of sparse components