# Hue-Saturation Thresholding

A final method was developed in the later stages of this project. In this method, the HSI colourspace is used instead of the RGB colourspace.

RGB is the normal way in which colours are specified in computers, as these are the numbers that monitors use to make red, green, and blue phosphors glow. However, this is not a natural way of thinking about colour. The HSI colourspace gives us more information, and makes it easier to segment or threshold our image.

A colour defined in HSI consists of three components: the Hue, Saturation, and Intensity. The Hue describes a pure colour (e.g. pure Yellow, Red, or Orange), and is specified as an angle. The Saturation is a measure of how much that colour has been diluted by white light. The Intensity value says how bright the colour is (0 being black. 1.0 or 255 being the brightest that colour can be).

This colour model has two primary advantages. First, the intensity information is decoupled from the colour information. This means that the colour information (HS) should be the same for a well lit scene and the same scene with poor lighting. This is especially useful in our system, where the photographs are taken outdoors, and the conditions can vary from sunny to overcast. Second, the hue and saturation components are related to the way in which humans perceive colour.

Conversion between RGB and HSI is possible, although due to the use of trigonometric functions, it is susceptible to noise. Further information on HSI and the conversions between RGB and HSI can be found in [5]

To Find the whales, a Hue-Saturation Histogram is taken of the image. This is similar to a standard histogram, except that it is in 2 dimensions, with one axis for the Hue, and one for Saturation. A sample HS histogram is shown in figure 4.7

Figure 4.7: Example Hue-Sat Histogram

In this diagram, the origin is in the top left hand corner. The Saturation increases down the image, while the hue increases to the right. The blacker a point is, the more pixels there are at that Hue-Saturation value. The example diagrams in this text have been log-lightened to make cells with low values visible.

In the image, most of the pixels lie in a line along the centre of the image. That is, most of the pixels are Blue-Green. At the lower saturations, there are also some pixels that are more green in colour.

It was found that the saturation component was higher for the water than it was for whales. Thus, if a threshold on the saturation is used, then it is possible to separate whales and water.

This method works quite well for images that contain blue water. However, many of the photographs that are used in the system were taken in overcast conditions, causing the water to become green. In this case, the Hue-Saturation histogram changed shape. Figure 4.8 shows an example histogram for one of these images.

Figure 4.8: Example Hue-Sat Histogram for a green image

Obviously, a simple Saturation Threshold will not work in this case, as the cluster does not extend far enough in the saturation dimension. However, one can see that there are two distinct clusters in the histogram, one at the blue-green point where we normally would expect the cluster for a blue image, which represents the water, plus another smaller cluster further up the hue scale, which represents the whale itself. Thus, for a green image, we can separate the whale and water by implementing a Hue Threshold in between these two clusters.

This means that we have two methods for thresholding the image: one for images with blue water, and one for images with green water. A method is needed to be able to differentiate between blue and green images. For a green image, the area covered by the histogram is much shorter, but is wider. Thus, if we fit a gaussian PDF to the histogram, and then examine the resultant ellipse, we can determine which type it is. The Gaussian PDF can also be used to determine the optimum point at which to threshold the image. The whales are then found using the same method as standard thresholding above.

Thus, our method consists of:

1. Calculate the Hue-Sat Histogram of the image
2. Fit a single gaussian PDF to the histogram
3. Calculate whether the image has green or blue water. This is achieved by examining the major eigenvector of the gaussian PDF fitted to the histogram
• If the hue component is larger than the sat component, then the image contains green water. Threshold the hue at the mean of the gaussian PDF plus of one standard deviation.
• If the sat component is largest, then the image contains blue water. Threshold the saturation at the mean of the gaussian PDF. In the resultant image, the regions of whale will be black, and the water white, so an invert operation is required.
4. Fit a gaussian PDF to the image to find the body of the whale.

This method achieves good results for the blue images. For green images, the results are not quite as good, although this can be attributed to the lesser quality of these images.