where weights xi are the probabilities of the two classes separated by a threshold t and r2 are the variances of these classes. Threshold t can be applied to distinguish oyster pixels from background. If the grey value of a given pixel is greater than or equal to the threshold then the pixel is marked as an oyster pixel. If it is less than threshold, the pixel is marked as a background pixel. This information is used to create a binary image, with grayscale value 255 representing the oyster pixels and grayscale value 0 representing the background pixels as shown in Fig. 2(b).