# Partial Order Rank Features in Colour Space
## 3 Materials and Methods  
### Rank Features on Partial Orders  
In this section we show how to generalise existing rank-based descriptors by replacing total order in grey-scale with suitable partial orders in colour space. In the remainder we shall use the Texture Spectrum [26] as our reference model--though other descriptors such as Local Binary Patterns and Local Ternary Patterns are amenable to the same procedure with virtually no effort. Figure 2: Loewner order in the HC\(\bar{L}\) space: A generic colour \(\left(h_{0},c_{0},\bar{l}_{0}\right)\) dominates all the colours in the blue volume and is dominated by all the colours in the red volume. In Texture Spectrum, a local image pattern \(\mathcal{P}=\left\{\mathbf{p}_{0},\mathbf{p}_{1},\ldots,\mathbf{p}_{n}\right\}\) is assigned a unique decimal code as follows:  
\[f_{\mathrm{TS}}\left(\mathcal{P}\right)=\sum_{i=1}^{n}\mathbf{3}^{i}\tau\left[g \left(\mathbf{p}_{0}\right),g\left(\mathbf{p}_{i}\right)\right] \tag{5}\]  
where \(\mathbf{p}_{0}\) represents the central pixel and \(\mathbf{p}_{i}\), \(i\in\left\{1,\ldots,n\right\}\) the peripheral pixels, which we assume to be arranged on a circle around the central pixel. We also assume that \(\mathbf{p}\) represents a point in a 3D colour space, though again extension to multi-spectral data is straightforward. In Equation (5) the function \(g\left(\mathbf{p}_{0}\right)\) stands for a generic conversion from colour into grey-scale, whereas \(\tau\left(u,w\right)\) indicates the ternary thresholding function:  
\[\tau\left(w,z\right)= \begin{cases}0&\text{if }w<z\\ 1&\text{if }w=z\\ 2&\text{if }w>z.\end{cases}  \tag{6}\]  
An image is represented by the dense, orderless statistical distribution over the set of possible codes. For Texture Spectrum, the number of (directional) features generated by the method is clearly \(3^{n}\). Invariance under rotations and/or reflections can be obtained by grouping together all those codes that represent patterns which can be transformed into one another by such transforms. The corresponding mathematical structures are _necklaces_ and _braclets_, respectively for invariance under rotations (i.e., cyclic group of order \(n\); \(C_{n}\)) and under rotations + reflections (i.e., dihedral group of order \(n\); \(D_{n}\)). For general formulas about the number of resulting \(C_{n}\)- and \(D_{n}\)-invariant features and for other mathematical details please refer to [PERSON] et al. [27], [PERSON] and [PERSON] [28]. Specifically, for \(n=8\) (which is the case considered herein--see below) the number of features is respectively 834 and 498. A ternary rank feature for partially ordered data analogous to Texture Spectrum--the Partial Order Texture Spectrum (POTS)--can easily be defined in the following way:  
\[f_{\mathrm{POTS}}\left(\mathcal{P}\right)=\sum_{i=1}^{n}\mathbf{3}^{i}\varphi \left(\mathbf{p}_{0},\mathbf{p}_{i}\right) \tag{7}\]  
\[\varphi\left(\mathbf{u},\mathbf{v}\right)= \begin{cases}0&\text{if }\mathbf{u} \prec\mathbf{v}\\ 1&\text{if }\mathbf{u}\succeq\mathbf{v}\\ 2&\text{if }\mathbf{u}\
sim\mathbf{v}\end{cases}  \tag{8}\]  
where \(\preceq\) indicates a generic partial order relation in the colour space (see Section 2.5). Notably, the number of features generated by this formulation is the same as generated by the Texture Spectrum. In the experiments we considered the following partial order/colour space combinations: product order (Section 2.5.1) in the RGB, Ohta's and opponent spaces [25]; Loewner order (Section 2.5.2) in the HCL space. When reporting experimental results we use subscripts 'RGB', 'ohta' and 'opp' to indicate the colour spaces, and superscripts \(\preceq_{\times}\) and \(\preceq_{L}\) respectively for the product and Loewner orders (see Equations (1) and (4)). No superscript was used to indicate the natural total order on greyscale values.