# Shortest Paths in HSI Space for Color Texture Classification

Mingxin Jin, Yongsheng Dong, Lintao Zheng, Lingfei Liang, Tianyu Wang, Hongyan Zhang

► To cite this version:

Mingxin Jin, Yongsheng Dong, Lintao Zheng, Lingfei Liang, Tianyu Wang, et al. Shortest Paths in HSI Space for Color Texture Classification. 2nd International Conference on Intelligence Science (ICIS), Nov 2018, Beijing, China. pp.273-281, 10.1007/978-3-030-01313-4_29. hal-02118803

HAL Id: hal-02118803

https://inria.hal.science/hal-02118803

Submitted on 3 May 2019

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Shortest Paths in HSI Space for Color Texture
Classification

Mingxin Jin¹, Yongsheng Dong¹*, Lintao Zheng¹, Lingfei Liang¹,
Tianyu Wang¹, Hongyan zhang¹

School of Information Engineering, Henan University of Science and Technology,
Luoyang, China

jinmingxin0501@163.com

dongyongsheng98@163.com

**Abstract.** Color texture representation is an important step in the task of texture classification. Shortest paths was used to extract color texture features from RGB and HSV color spaces. In this paper, we propose to use shortest paths in the HSI space to build a texture representation for classification. In particular, two undirected graphs are used to model the H channel and the S and I channels respectively in order to represent a color texture image. Moreover, the shortest paths is constructed by using four pairs of pixels according to different scales and directions of the texture image. Experimental results on colored Brodatz and USPTex databases reveal that our proposed method is effective, and the highest classification accuracy rate is 96.93% in the Brodatz database.

**Keywords:** Texture analysis, Shortest paths, Graph, HSI.

# 1 Introduction

Texture analysis is an active research topic in computer vision and pattern recognition. Its application is very extensive, including texture classification, segmentation, synthesis and retrieval. A texture is generally defined as a complex visual pattern composed of entities or sub-patterns with specific size, brightness and slope etc. As an important step in texture classification, texture feature extraction is to extract a discriminative feature from these complex visual pattern. Many scholars have made contributions to feature extraction that is usually divided into four major categories: statistical, signal processing, structural and model based methods. Statistical based methods such as Haralick et al. used the co-occurrence matrices to model the texture pattern [13]. Signal processing methods is also called transform-based methods. The widely used transforms include Gabor transform [14], wavelet transforms [15],[20],[23],[24], contourlet transforms [21] and shearlet transforms [22]. The typical structural approaches are the local binary pattern-based methods including complete local binary pattern (CLBP) [16] and scale selective local binary pattern (SSLBP) [17] and so on. The model based methods that depend on stochastic models to interpret image texture. In addition, some scholars put forward other methods, such as Martinez et al.
used deterministic tourist walk to analyze and classify texture [5], Backes et al. proposed fractal descriptors [6], complex network theory proposed by Costa et al. [7] and simplified gravitational systems [8], [9].

However, most of these analysis methods are on gray-scale image. In the real world, color texture is the main form of existence. The recognition of color texture is more consistent with human vision. Therefore, color texture classification is still a challenge in the field of texture classification. In the past literature, we know that many scholars have done a lot of research on color texture analysis. For example, Drimbarean et al. extended the three gray-scale related texture analysis methods to color image [3], Harvey et al. compared different color texture classification methods on the theoretical and experimental results [4]. Recently, Liu et al. used Gaussian copula models of Gabor wavelets to analysis color texture [18], Napoletano et al. compared hand-crafted and learned descriptors for color texture classification [19].

In this paper, we extend the analysis methods proposed in [1] and [2] respectively in RGB and HSV color space to HSI color space. Particularly, two undirected graphs are used to model the H channel and the S and I channel respectively in order to model a color texture image. First-order statistic of the shortest path is constructed by using four pairs of vertices according to different directions is calculated as features of the texture (called Shortest Paths in Graphs method – SPG method).

The remainder of the paper is organized as follows. Section 2 shows how a color texture can be modeled as graph in HSI color space. Section 3 presents the shortest path as the texture descriptors. In Subsection 4, we describe experiments in which our approach is compared against some traditional methods and the results achieve by our proposed methods. Finally, Section 5 gives a brief conclusion.

# 2 Model Texture to Graph

## 2.1 Graph and Shortest Path

In graph theory, a graph $G = (V, E)$ is composed of a vertex set $V$ and an edge set $E$. Due to that an digital image is expressed by its pixels, it is reasonable that any pixel in a given image texture can be considered as a vertex and relationship between any pair of pixels can be represented by an edge. As a classical problem in graph theory, the shortest path problem aims at finding the minimum path from the initial vertex to target vertex in a given weighted directed graph or undirected graph.

## 2.2 Modeling Texture to Graph

**Modeling an Undirected Graph from Texture.** Graphs can be divided into directed graphs and undirected graphs. The difference between them is
whether they are directional. In undirected graphs, the edge of the link vertex $v_i$ and $v_j$ lacks orientation, $(v_i, v_j) = (v_j, v_i)$. On the other hand, there is a clear starting vertex and end vertex, $(v_i, v_j) \neq (v_j, v_i)$. We aim to build a discriminant feature that characterizes an input texture image based on its undirected graph representation, which the first step of this processing is constructing the undirected graph that represents the neighborhood relation of the given image. A graph $G = (V, E)$ is composed of the set of vertices $V$ and edges $E$. We first set up the vertices set $V$. In this model, each pixel $I(x, y), x = 1, \dots, M$ and $y = 1, \dots, N$ is viewed as a vertex belong to the set. The location of this vertex in the graph is the same as in the original image. Secondly, we propose to represent the neighborhood relationship by using the edges set $E$, connecting to each pair of vertices where the Chebyshev distance between them is shorter than or equal to a threshold value $t$ ($t=1$ in our paper):

$$E = \{e = (v, v^0) \in V * V | \max(|x - x_0|, |y - y_0|) \le 1\} \quad (1)$$

where $x$ and $y$ are the Cartesian coordinates of the pixel $I(x, y)$ associated to the vertex $v$. Finally, weight $w(e)$ assigned to each $e \in E$, which is defined as:

$$w(e) = |I(x, y) - I(x_0, y_0)| + \frac{1}{2} [I(x, y) + I(x_0, y_0)] \quad (2)$$

where $I(x, y) = q, g = 0, \dots, L$ represents the intensity value of the corresponding pixel. Figure 1 shows an undirected graph on a gray-scale image.

<figure><img src="image_2.png" /><figcaption>Fig. 1. Undirected graph on gray-scale image</figcaption></figure>

**Graph Based Representation of an HSI Color Texture.** HSI color space is similar to RGB color space, each color is composed of three color components. But the difference is that the three color components of HSI are Hue (H), Saturation (S), and Intensity (I), where H represents the attribute of the pure color, S measures the extent of pure being diluted by the white light, and I is a subject description and a key parameter for human perception of color. The difference between the HSI color space and the HSV color space includes the difference in the representation of the first model, and second in the HSV, the component Value (V) represents the degree of bright color, and finally the calculation of the component V and the component I form the RGB color space is different.
In the process of building a graph. First, we regard pixels in each color channel as a vertex, and connect each pixel in a specific channel. This process is similar to the color texture analysis method introduced in article [1], [2]. Let $I_H(x, y)$, $I_S(x, y)$ and $I_I(x, y)$ be each color component in an HSI color texture. According to the method described in the previous section, each color components is constructed into an undirected graph. In this way, three separate undirected graphs in HSI color space represent a color texture image.

Furthermore, we would explore the neighborhood relationship between the color components belonging to neighbor pixels. Because the HSI color space reflects the way people perceive the color of the visual system. Human vision is most intuitive to hue perception, we suggest that the H channel be regarded as an independent undirected graph to represent the attribute of the pure color, and the other two channels S and I can be connected to construct a new graph. By adding restrictions to Equation (1), we create the edge that connects the S channel and I channel. The condition is $\{e = (v, v_0) | v \in S \land v_0 \in I\}$. As shown in Figure 2, texture images are represented by two undirected graphs.

<figure><img src="image_3.png" /><figcaption>Fig. 2. Modeling a HSI color texture</figcaption></figure>

<figure><img src="image_4.png" /><figcaption>Fig. 3. Weight equation analysis</figcaption></figure>

## 2.3 Edge Weight Analysis

In order to calculate the shortest path, Equation (2) is used to assign weights to each side of the undirected graph. The calculation of weights consists of two parts, each of which plays an important role in extracting feature vectors.

The first part of Equation (2) is the difference between the intensities of two color components. We use the absolute value of the difference to avoid negative values of weights. As Figure 3 shows above, exploring the shortest path from vertex V3 that maintains the intensity of the 0.1 color component, the shortest path will choose the edge between vertex V3 and V1. Obviously, the absolute value of the difference between the vertex V3 and V1 is smaller than the value
of between vertex V3 and V2. This means that those two vertices are similar.

Moreover, the second part of Equation (2) shows the average intensity between two vertices. In Figure 3, the absolute value of the difference between the vertices V3 and V1 is equal to the absolute value of the difference between the vertices V2 and V1. We have to consider the average intensity between two vertices as a second part of the weight equation. This part emphasizes exploring the lower levels of intensity in the texture image. By considering the two parts, we can obtain a balance absolute value of the difference and average intensity minimization during the computation of the shortest path in the image.

It is worth noting that in the undirected graph jointly represented by the S channel and I channel, the starting point and terminal point of the shortest path must be located in the same channel.

## 3 Express Color Texture Features with the Shortest Path

As mentioned above, we propose to construct two undirected graphs to represent the color texture images. One is an undirected graph composed of H-channel, and the other is an undirected graph composed of S-channel and I-channel. The shortest paths on two undirected graph are calculated as a feature vector. In order to hold as much as possible of information about the color texture, we recommend to calculate the shortest path between the four sets of vertices in different directions. The paths in these four directions are the diagonal direction (path $p_{45°}$ and $p_{-45°}$), horizontal (path $p_{0°}$) direction and vertical path (path $p_{90°}$), as shown in Figure 4.

<figure><img src="image_5.png" /><figcaption>**Fig. 4.** Four directions of the shortest paths</figcaption></figure>

<figure><img src="image_6.png" /><figcaption>**Fig. 5.** Examples of shortest path</figcaption></figure>

The starting and ending vertices of the shortest path are respectively on the three color components. We can obtain a total of twelve paths. On the other
hand, as both saturation and intensity correspond to one single undirected graph, the search for the shortest path according to a specified orientation will indeed explore both color channels as shown in Figure 5.

In order to describe the local texture image information as much as possible, we suggest covering the texture with a grid of size $r * r$, where r is a divisor of the original texture size. For each grid block, we calculate the four shortest paths ($p_{0^{\circ}}$, $p_{45^{\circ}}$, $p_{-45^{\circ}}$, $p_{90^{\circ}}$) on the three color components (for example, we can cover an image 128*128 pixels with 32*32 grid, each grid block size is 4*4 pixels). We use the Dijkstra algorithm to find the shortest path. Then, for each path direction $d^{\circ}$, $d^{\circ} = \{0^{\circ}, 45^{\circ}, -45^{\circ}, 90^{\circ}\}$, we compute the first-order statistics in each direction as average $\mu_{d^{\circ}}$ and standard deviation $\sigma_{d^{\circ}}$. By following this strategy, the feature vector can be defined as:

$$ \alpha_r^c = [\mu_{0^{\circ}}, \sigma_{0^{\circ}}, \mu_{45^{\circ}}, \sigma_{45^{\circ}}, \mu_{-45^{\circ}}, \sigma_{-45^{\circ}}, \mu_{90^{\circ}}, \sigma_{90^{\circ}}] $$

where r is the grid size of covering texture in a specific color channel $C = \{H, S, I\}$. Thus, one single vector that holds all the texture image texture is composed of these vectors $\alpha_r^H$, $\alpha_r^S$ and $\alpha_r^I$, which are the feature vectors characterizing each of the color channels:

$$ \theta_r = [\alpha_r^H, \alpha_r^S, \alpha_r^I] $$

According to the different size of the grid scale covering the texture, a multi-scale analysis can be accomplished by concatenating previous feature vectors corresponding to different grid size:

$$ \theta_{r_1, r_2, \dots, r_n} = [\theta_{r_1}, \theta_{r_2}, \dots, \theta_{r_n}] $$

# 4 Experiment and Results

In this section, various experiments are carried out to demonstrate the efficiency of our proposed texture classification method. The parameter r is used to define the grid size $r * r$ for covering texture image. In order to avoid dealing with overlapping grid, we choose the common divisors of the original texture image size (128*128 or 160*160) as the set of grid size r values: r=4,8,16,32. 1 values were omitted because it does not provide the desire information about the standard deviation, which makes the composition of the $\theta_r$ not possible. Moreover, when the grid size is 128*128 or 160*160, each grid block size is 1*1 pixel, it is too small to provide meaningful information about the texture.

We use the one nearest neighbor (1NN) classifier to evaluate the accuracy of our proposed approach for discrimination. At the same time, we use leave-one-out cross-validation that is using each sample in the database for validation while the remaining samples are used as the training set. And we also use hold-out strategy by considering 2/3 of the samples for training and 1/3 for testing, with 10 repetitions.
In this experiment, we evaluate our proposed texture classification on the colored Brodatz database and USPTex. Colored Brodatz not only preserves the advantages of the original Brodatz database rich texture content, but also has a variety of color content. For the experiment using this database, we consider a total of 1792 samples of 160*160 pixels size grouped in to 112 texture classes (16 texture samples per class). USPTex database consists of common textures, we consider a total 2292 samples of 128*128 pixels size grouped into 191 texture classes (12 texture samples per class). Figure 6 shows examples of texture in the USPTex database.

The proposed method is evaluated by two types of analysis, namely single-scale and multi-scale. Firstly, we conduct single-scale analysis. As seen in the Table 1, our proposed method has achieved good results in the Brodatz, the highest accuracy can reach 96.93% and 97.38%. As the size of the grid increase, so does the accuracy. This is due to the fact that the increase in grid size corresponds to a decrease in the size of the grid blocks to ensure better local texture analysis performance.

The second time we conduct a multi-scale analysis, the experimental results were slightly lower than single-scale. Table 2 shows the multi-scale results.

<table><caption>**Table 1.** The results of a single-scale on two texture database</caption><thead><tr><th rowspan="2"></th><th rowspan="2"></th><th colspan="8">Accuracy(%)</th></tr><tr><th colspan="4">1NN+holdout</th><th colspan="4">1NN+leave-one-out</th></tr></thead><tbody><tr><td rowspan="3">Grid size</td><td>32*32</td><td>16*16</td><td>8*8</td><td>4*4</td><td>32*32</td><td>16*16</td><td>8*8</td><td>4*4</td></tr><tr><td>96.93</td><td>90.77</td><td>86.2</td><td>73.38</td><td>97.38</td><td>91.8</td><td>88.06</td><td>75.17</td></tr><tr><td>57.8</td><td>31.13</td><td>28.18</td><td>24.06</td><td>59.81</td><td>33.03</td><td>29.93</td><td>24.04</td></tr><tr><td rowspan="3">USPTex</td><td>96.93</td><td>90.77</td><td>86.2</td><td>73.38</td><td>97.38</td><td>91.8</td><td>88.06</td><td>75.17</td></tr><tr><td>57.8</td><td>31.13</td><td>28.18</td><td>24.06</td><td>59.81</td><td>33.03</td><td>29.93</td><td>24.04</td></tr></tbody></table>

<table><caption>**Table 2.** The results of a multi-scale on two texture database</caption><thead><tr><th rowspan="3"></th><th rowspan="3"></th><th colspan="3">Accuracy (%)</th></tr><tr><th colspan="3">1NN+holdout</th></tr><tr><th>32,16</th><th>32,16,8</th><th>32,16,8,4</th></tr></thead><tbody><tr><td rowspan="2">Multi-scale</td><td>32,16</td><td>32,16,8</td><td>32,16,8,4</td></tr><tr><td>96.46</td><td>95.41</td><td>54.75</td></tr><tr><td>USPTex</td><td>54.75</td><td>50.9</td><td>45.55</td></tr></tbody><tbody><tr><td rowspan="2">1NN+leave-one-out</td><td>32,16</td><td>32,16,8</td><td>32,16,8,4</td></tr><tr><td>96.99</td><td>96.14</td><td>94.81</td></tr><tr><td>USPTex</td><td>56.46</td><td>52.53</td><td>47.21</td></tr></tbody></table>

Finally, we compare our proposed method with other representative texture classification methods including single-band SPG in RGB [1], HRF [10], Multi-Layer CCR [11] and MSD [12] by considering the feature vector $\theta_4$ with 1NN
+ holdout on USPTex database. In particular, we compared with the single-band methods in the RGB color space introduced in the literature [1], all of which are the same size grid (32*32, each grid block size is 4*4 pixels). Additionally, we also tested our approach against a simple method of average values of each R, G and B. The results shows in Table 3.

<table><caption>**Table 3.** Compared with other classic method on USPTex</caption><thead><tr><th></th><th>Accuracy (%)</th></tr></thead><tbody><tr><td>Method</td><td>1NN+holdout</td></tr><tr><td>Propose method</td><td>57.80</td></tr><tr><td>Single-band SPG in RGB [1]</td><td>54.39</td></tr><tr><td>HRF [10]</td><td>49.86</td></tr><tr><td>MultiLayer CCR [11]</td><td>82.08</td></tr><tr><td>MSD [12]</td><td>51.29</td></tr><tr><td>Average RGB</td><td>36.19</td></tr></tbody></table>

# 5 Conclusion

In this paper, we propose to use shortest paths in the HSI space to build a texture representation for classification. Two undirected graphs is used to model texture images, which are undirected graphs constructed by H channel and graphs constructed jointly by S channel and I channel. A texture representation vector can be obtained by computing the shortest path in four different directions in a specific channel. Experimental results show that our proposed color texture classification method is effective.

# References

1. Junior J. J. D. M. S., Cortez P. C., Backes A. R., "Color texture classification using shortest paths in graphs", *IEEE Transactions on Image Processing*, vol. 23, no. 9, 2014, p. 3751-3761.

2. Moutaouakkil M. E., Maliani A. D. E., Hassouni M. E., "A graph based approach for color texture classification in HSV color space", *International Conference on Wireless Networks and Mobile Communications*, 2017, p. 1-5.

3. Drimbarean A., Whelan P. F., "Experiments in colour texture analysis", *Pattern Recognition Letters*, vol. 22, no. 10, 2001, p. 1161-1167.

4. Harvey R. W., "Theoretical and experimental comparison of different approaches for color texture classification", *Journal of Electronic Imaging*, vol. 20, no. 4, 2011, p. 49-59.

5. Martinez A. S., Bruno O. M., "Texture analysis and classification using deterministic tourist walk", *Pattern Recognition*, vol. 43, no. 3, 2010, p. 685-694.
6. Backes A. R., Casanova D., Bruno O. M., "Color texture analysis based on fractal descriptors", *Pattern Recognition*, vol. 45, no. 5, 2012, p. 1984-1992.

7. Costa L. da F., Rodrigues F. A., Travieso G., and Boas P. R. V., "Characterization of complex networks: a survey of measurements. Adv Phy", *Advances in Physics*, vol. 56, no. 1, 2007, p. 167-242.

8. S J. J. D. M., Backes A. R., Cortez P. C., "A simplified gravitational model for texture analysis", *Journal of Mathematical Imaging and Vision*, vol. 47, no.1-2, 2013, p. 70-78.

9. Joaci D. M. S. J. J., Backes A. R., "A simplified gravitational model to analyze texture roughness", *Pattern Recognition*, vol. 45, no. 2, 2012, p. 732-741.

10. Paschos G., Petrou M., "Histogram ratio features for color texture classification", *Pattern Recognition Letters*, vol. 24, no. 1, 2003, p. 309-314.

11. Bianconi F., Caride D., "Rotation-invariant colour texture classification through multilayer CCR", *Pattern Recognition Letters*, vol. 30, no. 8, 2009, p. 765-773.

12. Liu G. H., Li Z. Y., Zhang L., "Image retrieval based on micro-structure descriptor", *Pattern Recognition*, vol.44, no.9, 2011, p. 2123-2133.

13. Haralick R. M., "Statistical and structural approaches to texture", *Proceedings of the IEEE*, vol.67, no. 5, 2005, p. 786-804.

14. Casanova D., et al. "Plant leaf identification using gabor wavelets", *International Journal of Imaging Systems and Technology*, vol. 19, no.3, 2010, p. 236-243.

15. Unser M., Texture classification and segmentation using wavelet frames, *IEEE Transactions on Image Processing*, vol. 4, no. 11, 1995, p. 1549C1560.

16. Guo Z. H., Zhang L., Zhang D., "A completed modeling of local binary pattern operator for texture classification", *IEEE Transactions on Image Processing A Publication of the IEEE Signal Processing Society*, vol. 19, no. 6, 2010, p. 1657-1663.

17. Guo Z. H, Wang X. Z., Zhou J., You J., "Robust texture image representation by scale selective local binary patterns (SSLBP)", *IEEE Transactions on Image Processing A Publication of the IEEE Signal Processing Society*, vol.25, no. 2, 2015, p. 687-699.

18. Li C. R., Huang Y., Zhu L., "Color texture image retrieval based on gaussian copula models of gabor wavelets", *Pattern Recognition*, vol. 64, 2017, p. 118-129.

19. Napoletano P., "Hand-crafted vs learned descriptors for color texture classification", *International Workshop on Computational Color Imaging Springer*, Cham, 2017, p. 259-271.

20. Dong Y. and Ma J., "Wavelet-based image texture classification using local energy histograms", *IEEE Signal Processing Letters*, vol. 18, no. 4, 2011, p. 247-250.

21. Dong Y. and Ma J., "Bayesian texture classification based on contourlet transform and BYY harmony learning of Poisson mixtures", *IEEE Transactions on Image Processing*, vol. 21, no. 3, 2012, p. 909-918.

22. Dong Y., Tao D., Li X., Ma J. and Pu J., "Texture classification and retrieval using shearlets and linear regression", *IEEE Transactions on Cybernetics*, vol. 45, no. 3, 2015, p. 358-369.

23. Dong Y., Tao D., and Li X., "Nonnegative multiresolution representation based texture image classification", *ACM Transactions on Intelligent Systems and Technology*, vol. 7, no. 1, 2015, p. 4:1-4:21.

24. Dong Y., Feng J., Liang L., Zheng L., and Wu Q., "Multiscale sampling based texture image classification", *IEEE Signal Processing Letters*, vol. 24, no. 5, 2017, p. 614-618.