Segmentation and stereo matching of agent bees. A Giant honeybee nest represents a compact matrix of individuals, arranged in multiple layers where bees adhere to subjacent layers with their legs. The surface layer and parts of the subsurface layer are visible in a-c and e. The luminance values have been inverted for better contrast. (a) Template patterns representing typical bees of varying size (s) were rotated at discrete angular steps (-11.5° ≥ θ ≥ + 11.5° in 2.86° steps). Outlier agent bees that did not match any of the prototypes (e.g. in turbulence areas such as the mouth zone  or convection holes; indicated by the red arrow in a) were not segmented. Segmentation resulted in assigning a rectangular area (green rectangles in a-c) to each individual bee within which the thoraces were defined (red crosses in a-c). (b,c) Data plots of a NCC (Normalized cross-correlation) segmentation of 505 identified agent bees: images in a and b are details from c, using five templates with a variation in orientation of 23°, and a maximum scale variation of 13.7% corresponding to 9 px at a reference bee length of 65.63 ± 0.45 px; n = 70. (d) Rectified honeybee templates demonstrating the challenges of stereo matching (see text): the segmented agent bee (yellow line in d,e) recorded by the left camera is to be identified in the paired image produced by the right camera (red line in d,e) only by the NCC similarity criterion. (e) Pair of rectified stereo images, in which all epipolar lines were aligned horizontally, so that corresponding points lie in the same image row.