• No results found

Histogram accumulation bin size calculation

the blue and red cube faces while ๐œƒ moves across the red and green cube faces. As such, the angle increment is also a factor of the two RGB colour faces.

Reducing the histogram dimensionality (bin count) reduces the overall processing costs as the time complexity ๐‘‚(๐‘) is dependent on the number of overall bins. The overall number of bins becomes more important once histogram testing occurs. Histogram bin size is dependent on the volume of the oblique square pyramid, with the apex at the origin of the colour space, (0, 0, 0) (black) to the colour space extremity in which one or two colour-channels are at maximum, such as (0.95, 0.95, 1.0) shown in Figure 8-3. The bin volume is a factor of the height from the pyramid apex to the base. For a set area on the surface of the colour space, each colour pyramid will contain slightly different volumes. The variation in volume may cause bias in the data collected for each bin, placing greater emphasis on different colour combinations. While adaptive bin sizes are able to equalise colour distribution in a histogram, they have been difficult to use in practice as histogram comparison methods only work on similar shaped bins. Leow [211] provided a possible solution. This work does not follow Leowโ€™s path, but it does ensure that all histograms use consistent optimised pyramid base sizes. Figure 8-4 contains the histograms of colour pyramid altitude distributions. With a base size of 5 x 5 colour points, each face of the colour space contains 2601 bins per colour face (7803 total bins). Figure 8-4 displays the discrete histogram bin volumes across the colour space. As can be seen in the left image of Figure 8-4, there is a disproportionate number of histogram bins that account for the majority of the colour space volume. There is a 71% increase in bin volume size, from the smallest bin to the largest, but the largest bins contribute to less than 0.5% of the total colour space volume. The histogram bins containing the largest volumes are centred along the grey-line (achromatic).

Figure 8-4. Histogram bin volume distribution Left: Base Size 5 x 5

Expanding the colour pyramid base reduces the large disproportionate bin volumes between bins along the grey-line and smaller bin volumes. Selecting a pyramid base size of 15 x 15 colour points produces histogram bin volumes as shown in the right image of Figure 8-4. This pyramid attribute produces 289 bins per colour space face (867 total bins), but also an improves (balances) the distribution of pyramid bin volume. Two-dimensional histogram distributions create a unique signature, as shown in Figure 8-5 in which the histogram represents the colour distribution of the green leaf. Higher scoring accumulation bins, such as the six or seven large amplitude bins shown in Figure 8-5, provide the input parameters for the segmentation of the target image. Pixel colours associated with the peak accumulation bins of the object signature, are set as foreground while the rest are background, producing a hotspot map.

Assessing the appropriate square pyramid base size is critical for effective operation of the two-dimensional colour histogram model. Apart from compensating for the accumulation bin volumes, varying the size of the pyramid base changes the size of the colour gamut available for classification. Figure 8-6 demonstrates the changes to the image segmentation as the square pyramid base size is adjusted from a size of 10 to 40.

Figure 8-5. Two-Dimensional Histogram of Green Leaf

base = 10 base = 20 base = 30 base = 40 Figure 8-6. Histogram segmentation (Varying pyramid base size)

Additionally, the number of accumulation bins to use in segmentation is also a valid parameter. In the histogram signature shown in Figure 8-5, the user may select a single bin or all to affect the final outcome.

8.2.3 Histogram Matching

Colour image histograms provide non-spatial data which may be employed in a number of ways to reflect objects within an image. The histogram model parameters provide a means to control the final outcomes. For fine resolution histograms, it is difficult for image colour histograms to successfully match or segmentation due to the slight variations which occur because of the colour noises (see Section 4.2, Image Noise Sources). Creating histogram bin sizes which accumulate more than one colour value results in smaller yet course histograms. Discovering the optimum histogram bin size is the subject of much research [182, 211, 212], with the method selection based on the type of secondary processing required, and the type of image scene (such as patterns or solid colours).

8.2.3. (a) Segmentation Matching

Colour histograms created from the template or the image of the object of interest, are used to perform colour histogram segmentation, which creates a hotspot of foreground pixels, as shown in Figure 8-6. Within the region of interest window, all foreground pixels are selected and averaged to generate the hotspot mean point. For each consecutive frame, the search window is segmented to locate a new hotspot. This is explained in detail in Section 11.2, Experimentation Methodology. The nature of this segmentation method allows the greatest density of foreground pixels, within the search process, to be selected as the new location of the prototype. This method is used for both two-dimensional colour histograms developed as part of this research and HSI histogram object detection (Section 10.2.2, Segmentation - Colour Indexing) and tracking (Section 11.8, Tracking Metrics).

HSI Histogram

User selection of a point on the object of interest initiates a process whereby the RGB colour channels of the selected pixel are converted to the saturation and hue values of the HSIโ€™s colour space. Brightness is ignored for these purposes, as we are only interested in the primary colour frequency. A vertical cylinder within the HSI colour space, shown in Figure 8-7, is centred on the userโ€™s selected saturation and hue value.

The cylinder is now the range of colours to be accepted as foreground pixels in the segmentation process. The base radius of the cylinder provides the user with an option for the sensitivity and discrimination of the segmentation.

Hotspot Matching

Both the RGB and HSI colour space histogram segmentation and tracking systems employ the simple steps shown in Figure 8-8. Once the colour range is initialised, the current image is segmented according to the colour range. To improve processing speed, segmentation occurs only within the search area mask. The search area is scanned to locate masks that are the closest match to the object of interest signature. For segmentation models, spatial data matching is ignored. Instead, the ROI mask with the greatest foreground pixel density is chosen as the best match. The coordinates for the chosen mask are used to adjust the tracking mask, and the procedure awaits the next frame to begin the object detection process again.

Failure to locate any masks with sufficient foreground pixels, results in a failure to match to an object. Tracking recovery methods are based on works by Shi & Tomasi

Figure 8-8. Tracking stages for segmentation models

[165], and are explained in detail within Section 8.3, Operational Parameter Analysis Tracking Trials.

8.2.3. (b) Goodness of Fit

From the values of phi (๐œ‘) and theta (๐œƒ) for the RGB discrete value, along/within the square pyramid, two accumulation bin indexes are created. The values of ๐œ‘ and ๐œƒ are derived from the RGB values as shown in Equation 8-3 and Equation 8-4. Histogram accumulation bin sizes are chosen from the userโ€™s input. User selects the base size of the square pyramid. Calculating the angle increments for the accumulation bin sizes, assumes the standard 256 (8 bit) colour values. Equation 8-4 provides the calculation for the angle increment value and accumulation bins. Employing standard histogram testing regimes, such as the chi-squared (๐œ’2) testing shown in Equation 8-5, compares

histograms to ascertain their goodness of fit, a measure of their similarity. The bins created from the ๐œ‘ and ๐œƒ values represent the two-dimensional attributes of the histogram.

Test of Homogeneity

Histogram matching, for the purpose of Computer Vision object matching, may also use standard statistical methods to ascertain the level of similarity between two histograms. Regardless whether either the two-dimensional colour histogram model, or HSI colour histogram model are employed, the chi-squared (๐œ’2) test of test of

homogeneity (or Pearsonโ€™s Chi-Squared test [175]) will provide an indication in the level of similarity between the signature histogram, and the current test histogram. The prototype histogram, created once the user selects a region of the video to track, is tested against each of the test regions of the search area. Figure 8-9 shows the example of the red gear assemblyโ€™s two-dimensional colour histogram, as used during tracking tests. The chi-squared test, shown in Equation 8-5, in detail becomes a statistic of the null hypothesis, which is that the histogram of the test area is not a match of the prototype.

ฯ‡2(v) = โˆ‘ (Observed โˆ’ Expected) 2

Expected

allbins