Color–Texture Pattern Classiﬁcation Using Global–Local Feature Extraction, an SVM Classiﬁer, with Bagging Ensemble Post-Processing

Featured Application: The proposed method is a new tool to characterize colored textures and may be applied in various applications such as content image retrieval, characterization of rock samples, biometrics, classiﬁcation of fabrics, and in non-destructive inspection in wood, steel, ceramic, fruit, and aircraft surfaces. Abstract: Many applications in image analysis require the accurate classiﬁcation of complex patterns including both color and texture, e.g., in content image retrieval, biometrics, and the inspection of fabrics, wood, steel, ceramics, and fruits, among others. A new method for pattern classiﬁcation using both color and texture information is proposed in this paper. The proposed method includes the following steps: division of each image into global and local samples, texture and color feature extraction from samples using a Haralick statistics and binary quaternion-moment-preserving method, a classiﬁcation stage using support vector machine, and a ﬁnal stage of post-processing employing a bagging ensemble. One of the main contributions of this method is the image partition, allowing image representation into global and local features. This partition captures most of the information present in the image for colored texture classiﬁcation allowing improved results. The proposed method was tested on four databases extensively used in color–texture classiﬁcation: the Brodatz, VisTex, Outex, and KTH-TIPS2b databases, yielding correct classiﬁcation rates of 97.63%, 97.13%, 90.78%, and 92.90%, respectively. The use of the post-processing stage improved those results to 99.88%, 100%, 98.97%, and 95.75%, respectively. We compared our results to the best previously published results on the same databases ﬁnding signiﬁcant improvements in all cases. local partitions ﬁve


Introduction
Texture pattern classification was considered an important problem in computer vision for many years because of the great variety of possible applications, including non-destructive inspection of abnormalities on wood, steel, ceramics, fruit, and aircraft surfaces [1][2][3][4][5][6]. Texture discrimination remains a challenge since the texture of objects varies significantly according to the viewing angle, illumination conditions, scale change, and rotation [1,4,7,8]. There is also the special problem of color image retrieval related to appearance-based object recognition, which is a major field of development for several industrial vision applications [1,4,7,8].
Orientational-invariant Neural or multi-scale SOON) was presented that reached 91.03% accuracy on the Brodatz database, which contains 111 different colored textures. These results were compared with those of two previous studies on the same database, reported in References [43,44], which reached classification rates of 89.71% and 88.15%, respectively. Another approach used all the information from sensors that created the image [4]. This method improved the results to 98.61% and 99.07%, on the same database, but required a non-trivial change in the architecture of the data collection. A texture descriptor based on a local pattern encoding scheme using local maximum sum and difference histograms was proposed in Reference [8]. The experimental results were tested on the Outex and KTH-TIPS2b databases reaching 95.8% and 91.3%, respectively. In References [32,33,36,39], the methods were not tested in the complete databases. In References [26,45,46], the methods used a different metric to calculate the classification.
A new method for the classification of complex colored textures is proposed in this paper. The images are divided into global and local samples where features are extracted to provide a new representation into global and local features. The feature extraction from different samples of the image using quadrants is described. The extraction of the features in each of the image quadrants, obtaining color and texture features in different spatial scales, is presented: the global scales using the whole image, and the local scales using quadrants. This representation seems to capture most of the information present in the image to improve colored texture classification. Then, a support vector machine classification that was performed is reported and, finally, the post-processing stage using the bagging that was implemented is presented. The proposed method was tested on four different databases: Colored Brodatz Texture [20], VisTex [4], Outex [47], and KTH-TIPS2b [48] databases. The subdivision of the training partition of the database into sub-images while extracting information from each sub-image of different sizes is also new. The results were compared to state-of-the art methods whose results were already published on the same databases.

Materials and Methods
The objective was to create a method for colored texture classification that would improve the classification of different complex color patterns. The BQMP method was used previously in color data compression, color edge detection, and multiclass clustering of color data, but not in classification [6,47]. The BQMP reduces an image to representative colors and creates a histogram that indicates the parts of the image that are represented by these colors. Therefore, the color features of the image are represented in this histogram. Haralick's features [3] are often extracted to characterize textures that measure the grayscale distribution, as well as considering the spatial interactions between pixels [3,9,23,38]. Creating a training set is part of the strategy for obtaining local and global features that contain all the information, local and global, for achieving correct classification. Different classifiers, such as k-nearest neighbors, neural networks, and support vector machines (SVM) [41], are used to combine features. In Reference [44], an SVM showed good performance compared to 16 different classification methods.

Feature Extraction Quadrants
The proposed method divides the images to obtain local and global features from them. The method consists of four stages: firstly, the images in the database are divided into images to be used in training and those to be used in testing. In the second stage, color and texture features are extracted from the training images on both global and local scales. In the third stage, color and texture features are fused to become the inputs to the SVM classifier, and the last stage is a post-processing stage that uses bagging with the test images for classification. These stages are summarized in the block diagram of Figure 1. To be able to compare the performance of our method with previously published results, we used the same partition, into training and testing sets, in each database. In the case of the Brodatz database, as in Reference [1], each colored texture image was partitioned into nine sub-images, using eight for training, and one for testing. An example of this partition is shown in Figures 2a-c. The Brodatz Colored Texture (CBT) database has 111 images of 640 × 640 pixels. Each image in the database has a different texture. For the Vistex database, the number of training and testing images was eight as in Reference [4]. In the case of the Outex database, the number of training and testing sub-images was 10 as in References [4,9,47]. The KTH-TIPS2b database was already partitioned into four samples, and we performed a cross-validation as in References [7,48]. To be able to compare the performance of our method with previously published results, we used the same partition, into training and testing sets, in each database. In the case of the Brodatz database, as in Reference [1], each colored texture image was partitioned into nine sub-images, using eight for training, and one for testing. An example of this partition is shown in Figure 2a To be able to compare the performance of our method with previously published results, we used the same partition, into training and testing sets, in each database. In the case of the Brodatz database, as in Reference [1], each colored texture image was partitioned into nine sub-images, using eight for training, and one for testing. An example of this partition is shown in Figures 2a-c. The Brodatz Colored Texture (CBT) database has 111 images of 640 × 640 pixels. Each image in the database has a different texture. For the Vistex database, the number of training and testing images was eight as in Reference [4]. In the case of the Outex database, the number of training and testing sub-images was 10 as in References [4,9,47]. The KTH-TIPS2b database was already partitioned into four samples, and we performed a cross-validation as in References [7,48]. For the Vistex database, the number of training and testing images was eight as in Reference [4]. In the case of the Outex database, the number of training and testing sub-images was 10 as in References [4,9,47]. The KTH-TIPS2b database was already partitioned into four samples, and we performed a cross-validation as in References [7,48].
In each case, we subdivided the training database and the test database using two parameters: n is the number of images divided by side, and r is the times we take n 2 local images from each sample. We Appl. Sci. 2019, 9, 3130 5 of 20 can take r × n 2 local images to extract features from all the samples in each database. Figure 3 shows the image subdivision scheme for the training images. It can be observed that the partitioning scheme allows obtaining features from different parts of the image, at a global and local level. The method was designed to follow this approach so that no relevant information would be lost from the image.
In each case, we subdivided the training database and the test database using two parameters: n is the number of images divided by side, and r is the times we take n 2 local images from each sample. We can take r × n 2 local images to extract features from all the samples in each database. Figure 3 shows the image subdivision scheme for the training images. It can be observed that the partitioning scheme allows obtaining features from different parts of the image, at a global and local level. The method was designed to follow this approach so that no relevant information would be lost from the image. (c,f) Image is divided into n 2 random blocks. (d,g) Image is divided into r × n 2 random blocks. In this example, (b-d) n = 2, (e-g) n = 3, and r = 2 (d,g).
BQMP and Haralick (without using co-occurrence matrices) are invariant to translation and rotation; the same features are obtained if an exchange of the position of two pixels is made in the image [3,6,47]. This suggests that there is spatial information present in the image that is not extracted by these features. In our proposed method, we use the two-scale scheme, local and global, to add spatial information to the extracted features. This is shown in Figure 4, and explained in detail in Section 2.4. The BQMP and Haralick features are extracted in each quadrant. The test images can be subdivided into local images from which the features are extracted. This allows the creation of a postprocessing stage in which a bagging process can be performed. Our method is invariant to translation because of the randomness of the local image positions, but it is partially invariant to rotation because the features are concatenated in an established order. However, color features, as well as Haralick texture features, are invariant to rotation. There are problems where orientation dependency is desirable [49].  (c,f) Image is divided into n 2 random blocks. (d,g) Image is divided into r × n 2 random blocks. In this example, (b-d) n = 2, (e-g) n = 3, and r = 2 (d,g).
BQMP and Haralick (without using co-occurrence matrices) are invariant to translation and rotation; the same features are obtained if an exchange of the position of two pixels is made in the image [3,6,47]. This suggests that there is spatial information present in the image that is not extracted by these features. In our proposed method, we use the two-scale scheme, local and global, to add spatial information to the extracted features. This is shown in Figure 4, and explained in detail in Section 2.4. The BQMP and Haralick features are extracted in each quadrant. The test images can be subdivided into local images from which the features are extracted. This allows the creation of a post-processing stage in which a bagging process can be performed. Our method is invariant to translation because of the randomness of the local image positions, but it is partially invariant to rotation because the features are concatenated in an established order. However, color features, as well as Haralick texture features, are invariant to rotation. There are problems where orientation dependency is desirable [49].
Appl. Sci. 2019, 9, 5 of 20 In each case, we subdivided the training database and the test database using two parameters: n is the number of images divided by side, and r is the times we take n 2 local images from each sample. We can take r × n 2 local images to extract features from all the samples in each database. Figure 3 shows the image subdivision scheme for the training images. It can be observed that the partitioning scheme allows obtaining features from different parts of the image, at a global and local level. The method was designed to follow this approach so that no relevant information would be lost from the image. (c,f) Image is divided into n 2 random blocks. (d,g) Image is divided into r × n 2 random blocks. In this example, (b-d) n = 2, (e-g) n = 3, and r = 2 (d,g). BQMP and Haralick (without using co-occurrence matrices) are invariant to translation and rotation; the same features are obtained if an exchange of the position of two pixels is made in the image [3,6,47]. This suggests that there is spatial information present in the image that is not extracted by these features. In our proposed method, we use the two-scale scheme, local and global, to add spatial information to the extracted features. This is shown in Figure 4, and explained in detail in Section 2.4. The BQMP and Haralick features are extracted in each quadrant. The test images can be subdivided into local images from which the features are extracted. This allows the creation of a postprocessing stage in which a bagging process can be performed. Our method is invariant to translation because of the randomness of the local image positions, but it is partially invariant to rotation because the features are concatenated in an established order. However, color features, as well as Haralick texture features, are invariant to rotation. There are problems where orientation dependency is desirable [49].  These five images generate two spatial scales: four local (b) and one global, adding spatial information to the extracted features.

BQMP Color Feature Extraction
After image subdivision, the BQMP was applied to each one of the local and global sub-images. This method is used as a tool for extracting color features using quaternions. Each pixel in the RGB space is represented as a quaternion. In Reference [6], the authors showed that it is possible to obtain two quaternions that represent a different part of the image, obtaining a binarization of the image in the case of two colors. For more colors, this method can be performed recursively n times, yielding 2 n representatives of an image, and the part of the image that each representative represents in a histogram. The process is repeated, obtaining a result with a binary tree structure. Figure 5 shows the BQMP method for the case of four different colors. The numbers show the color code and the number of pixels represented by each. Figure 6 shows the second iteration for the same case.
The feature vector is formed by concatenating the color code and histograms, through normalization. This vector is concatenated with the ones in other scales and the ones made using Haralick statistics, which are also normalized.

BQMP Color Feature Extraction
After image subdivision, the BQMP was applied to each one of the local and global sub-images. This method is used as a tool for extracting color features using quaternions. Each pixel in the RGB space is represented as a quaternion. In Reference [6], the authors showed that it is possible to obtain two quaternions that represent a different part of the image, obtaining a binarization of the image in the case of two colors. For more colors, this method can be performed recursively n times, yielding 2 n representatives of an image, and the part of the image that each representative represents in a histogram. The process is repeated, obtaining a result with a binary tree structure. Figure 5 shows the BQMP method for the case of four different colors. The numbers show the color code and the number of pixels represented by each. Figure 6 shows the second iteration for the same case.  The feature vector is formed by concatenating the color code and histograms, through normalization. This vector is concatenated with the ones in other scales and the ones made using Haralick statistics, which are also normalized.

BQMP Color Feature Extraction
After image subdivision, the BQMP was applied to each one of the local and global sub-images. This method is used as a tool for extracting color features using quaternions. Each pixel in the RGB space is represented as a quaternion. In Reference [6], the authors showed that it is possible to obtain two quaternions that represent a different part of the image, obtaining a binarization of the image in the case of two colors. For more colors, this method can be performed recursively n times, yielding 2 n representatives of an image, and the part of the image that each representative represents in a histogram. The process is repeated, obtaining a result with a binary tree structure. Figure 5 shows the BQMP method for the case of four different colors. The numbers show the color code and the number of pixels represented by each. Figure 6 shows the second iteration for the same case.  The feature vector is formed by concatenating the color code and histograms, through normalization. This vector is concatenated with the ones in other scales and the ones made using Haralick statistics, which are also normalized.

Haralick Texture Features
The Haralick texture features are angular second moment, contrast, correlation, sum of squares, inverse difference moment, sum average, sum variance, sum entropy, entropy, difference variance, difference entropy, and information measures of correlation [3]. Other measures characterize the complexity and nature of tone transitions in each channel of the image. The usual practice is to use the first 13 Haralick features with a co-occurrence matrix [4], but in this work, we extracted the 13Haralick features directly from the images because they provide spatial information from different regions within each image.
Angular second moment: Contrast: where i − j = n. Correlation: where µ x , µ y , σ x , and σ y are the means and standard deviations of p x and p y . Sum of squares: Inverse difference moment: Sum average: Sum variance: Sum entropy: Entropy: Difference variance: Difference entropy: Appl. Sci. 2019, 9,3130 8 of 20 Information measures of correlation: where HX and HY are the entropies of p x and p y , and In Equations (1)-(13), to calculate the features, the following notation was used: which is the (i,j)th pixel in a gray sub-image matrix.
which is the ith entry in the sub-image matrix, obtained by summing the rows of p.
which is the jth entry in the sub-image matrix, obtained by summing the columns of p.

Feature Extraction
The feature extraction is performed using local and global scales. The feature vector is created by extracting features from each different image partition (local and global). An example is shown in Figure 7. The original image (a) is divided into five partitions, (b) four local and one global (the same original image), as shown in Figure 4. The feature vector is obtained from each partition as shown in (c). Since BQMP is applied once, we obtain different values for two representative colors for each sub-image. As in the example shown in Figure 7c, the first representative color is brown with R1 = 78, G1 = 62, and B1 = 39. The other color is pink with R2 = 215, G2 = 80, B2 = 119. Through binarization, we know that brown represents 41% of the image and pink 59%; therefore, H1 = 0.41 and H2 = 0.59.
To achieve the binarization, the three-dimensional RGB information was transformed in a four-dimensional quaternion. Those quaternions were used to obtain the moments of order 1, 2, and 3, and the moments were used to obtain the equations of momentum conservation, to obtain the representative colors (R1,G1,B1 and R2,G2,B2) and the representative histograms (H1 and H2), as Reference [6] described. The moments were computed using quaternion multiplication that is a four-dimensional operation. For example, in the case of two quaternions a = a 1 + a 2 i + a 3 j + a 4 k Therefore, even if a 1 and b 1 are equal to zero, the real part of the multiplication will not necessarily be zero. In the case of the example, this extra information is Q1 = −0.61 in the first color and Q2 = 0.43 in the second color.
Then, we extracted the 13 Haralick features (explained in Section 2.3) in each sub-image and each color channel, obtaining 13 × 5 × 3 = 195 more features to concatenate into the final vector.
In the texture of Figure 7, we performed only one BQMP iteration in an image from Brodatz database, obtaining only two color representatives. In general, the BQMP method generates 2 n representatives from each image, when n iterations are used. In Figures 5 and 6, an example for a simple color pattern shows the representatives for two iterations, n = 2. In our preliminary experiments, the results did not improve significantly for n ≥ 3, and computational time increased significantly. The feature extraction was performed in local and global scales, so that the representative colors would capture the diversity of the whole image in a local and global manner.
In the case of more complex textures, it is possible to use more iterations of the BQMP method obtaining more representative colors, histograms, and quaternions. Figure 8 shows the feature extraction from one sample image from the Vistex database (Food0007) using one, two, or three iterations of the method.
Appl. Sci. 2019, 9, 9 of 20 To achieve the binarization, the three-dimensional RGB information was transformed in a fourdimensional quaternion. Those quaternions were used to obtain the moments of order 1, 2, and 3, and the moments were used to obtain the equations of momentum conservation, to obtain the representative colors (R1,G1,B1 and R2,G2,B2) and the representative histograms (H1 and H2), as Reference [6] described. The moments were computed using quaternion multiplication that is a fourdimensional operation. For example, in the case of two quaternions = + + + and = + + + , the product will be equal to . Therefore, even if and are equal to zero, the real part of the multiplication will not necessarily be zero. In the case of the example, this extra information is Q1 = −0.61 in the first color and Q2 = 0.43 in the second color.
Then, we extracted the 13 Haralick features (explained in Section 2.3) in each sub-image and each color channel, obtaining 13 × 5 × 3 = 195 more features to concatenate into the final vector.
In the texture of Figure 7, we performed only one BQMP iteration in an image from Brodatz database, obtaining only two color representatives. In general, the BQMP method generates 2 n representatives from each image, when n iterations are used. In Figures 5 and 6, an example for a simple color pattern shows the representatives for two iterations, n = 2. In our preliminary experiments, the results did not improve significantly for n ≥ 3, and computational time increased significantly. The feature extraction was performed in local and global scales, so that the representative colors would capture the diversity of the whole image in a local and global manner. In the case of more complex textures, it is possible to use more iterations of the BQMP method obtaining more representative colors, histograms, and quaternions. Figure 8 shows the feature extraction from one sample image from the Vistex database (Food0007) using one, two, or three iterations of the method.

SVM Classifier and Post-Processing
After features were extracted from each image, an SVM classifier was used to determine each texture class. The SVM became very popular within the machine learning community due to its great classification potential [41,42]. The SVM maps input vectors in a non-linear transformation to a highdimensional space where a linear decision hyperplane is constructed for class separation. A Gaussian SVM kernel was used, and a coarse exhaustive search over the remaining SVM parameters was performed to find the optimal configuration on the training set.
A grid search with cross-validation was used to find the best parameters for the multiclass SVM cascade. We used half of the training set to determine the SVM parameters, and the other half in validation. For testing, we used a different set as explained in Section 3.1. In the case of bagging, we took repeated samples from the original training set for balancing the class distributions to generate new balanced datasets. Two parameters were tuned: the number of decision trees voting in the

SVM Classifier and Post-Processing
After features were extracted from each image, an SVM classifier was used to determine each texture class. The SVM became very popular within the machine learning community due to its great classification potential [41,42]. The SVM maps input vectors in a non-linear transformation to a high-dimensional space where a linear decision hyperplane is constructed for class separation.
A Gaussian SVM kernel was used, and a coarse exhaustive search over the remaining SVM parameters was performed to find the optimal configuration on the training set.
A grid search with cross-validation was used to find the best parameters for the multiclass SVM cascade. We used half of the training set to determine the SVM parameters, and the other half in validation. For testing, we used a different set as explained in Section 3.1. In the case of bagging, we took repeated samples from the original training set for balancing the class distributions to generate new balanced datasets. Two parameters were tuned: the number of decision trees voting in the ensemble, and the complexity parameter related to the size of the decision tree. The method was trained for texture classification using the training sets as they are specified for each database.
In order to have a fair comparison between our obtained classification rates and those previously published, we employed the same partitions used for training and testing as in Diaz-Pernas et al.  [50]. The training and test sets came from separate sub-images, and the methods never used the same sub-image for both training and testing.
In general, combining multiple classification models increases predictive performance [51]. In the post-processing stage, a bagging predictive model composed of a weighted combination of weak classifiers was performed with the results of the SVM model [52]. Bagging is a technique which uses bootstrap sampling to reduce the variance and improve the accuracy of a predictor [51]. It may be used in classification and regression. We created a bagging ensemble for classification using deep trees as weak learners. The bagging predictor was trained with new images taken from the training set of each database. This result was assigned as the final classification for each image.
We compared our results with those published previously on the same databases.

Databases
It is important to validate the method on standard colored texture databases with previously published results [53]. Therefore, we chose four colored texture databases that were used recently for this purpose: the Colored Brodatz Texture (CBT) [20], Vistex [4], Outex [47], and KTH-TIPS2b [48] databases.
The Brodatz Colored Texture (CBT) database has 111 images of 640 × 640 pixels. Each image in the database has a different texture. The Vistex Database was developed at Massachusetts Institute of Technology (MIT). It has 54 images of 512 × 512 pixels. Each image in the database has a natural color texture. The Outex Database was developed at the University of Oulu, Finland. We used 68 color texture images of 746 × 538, to obtain 1360 images of 128 × 128 with 68 different textures. Each image in the database has a natural color texture. Finally, the KTH-TIPS2b database contains images of 200 × 200 pixels. It has four samples of 108 images of 11 materials at different scales. Each image in the database has a natural color texture.

Experiments
In order to have a fair comparison between our obtained classification rates and those previously published, we used the same databases and partitions used for training and testing as in Diaz-Pernas et al.  [50]. The training and test sets came from separate sub-images, and the methods never used the same sub-image for both training and testing.

Brodatz Database
The methodology, as in Reference [1], used four different sets of images from the same database: the first one consisted of 10 images, the second of 30 images, the third of 40 images, and the fourth of all 111 images. The classification results in previously published articles reached 91.03% in Reference [1], 89.71% in Reference [43], and 88.15% in Reference [44] for the fourth set of the Brodatz database. We used the same partition used for training and testing as in Diaz-Pernas et al., 2011 [1]. The Brodatz image database consists of 111 images of size 640 × 640 pixels. Partitioning each image into nine non overlapping sub-images of 213 × 213 pixels, we obtained 999 sub-images from 111 texture classes. Diaz-Pernas et al., 2011 [1], using the (2 × 2) center sub-image as training and the other to test, reached the best classification results (see Figure 2).
In training, each training sub-image with a size of 213 × 213 pixels was subdivided into a number n of images. Features were extracted from each subdivided image. The parameter n changed from 2 to 7 in the first three experiments, and from 2 to 9 in the last one. Once the feature vector was computed, each vector was assigned to a texture class using an SVM as a classifier.

Outex Database
The methodology used 68 images that were subdivided into 1360 sub-images; 680 were used in training and the other 680 as testing images, as in Arvis et al., 2004 [9]. The same partition was performed by Mäenpää et al., 2004 [27], Qazi et al., 2011 [28], Losson et al., 2013 [4], and Couto et al., 2017 [50]. Previously published results reached 94.85% and 94.41% [4] on the same database using CFA chromatic co-occurrence matrices. We chose the same 68 texture images and partition to be able to compare our results with those previously published.

KTH-TIPS2b Database
The KTH-Tips2b database consists of four sets of 1,188 images. Each set has 11 different classes. The methodology used four sets of 108 images, each one with 11 images, making a total of 1188 images. We followed the same protocol described in Reference [7], where the average classification performance was reported over four test runs. In each run, all images from one sample were used for training, while all the images from the remaining three samples were used for testing as in Khan et al., 2015 [7]. Previously published results reached 70.6% [7] and 91.3% [8] on the same database using Divisive Information Theoretic Clustering (DITC) and three-dimensional adaptive sum and difference (3D-ASDH) methods, respectively. Table 1 shows the classification results for the Brodatz database. In this experiment, we used the features extracted in the first set (10 images), varying the size of the images in training r × n 2 . The last column shows the results of using the post-processing stage applied on the column with the best performance. The best result for the first experiment on the Brodatz database using 10 images was 100%. In this case, 27 (3 × 3 2 ) images with size 71 × 71 (213/3) pixels were used for training. It can also be observed that the use of the post-processing step improved the results up to 100% in all cases. These results were higher than 98.23%, the best result previously published for this experiment on the Brodatz database [1]. Also, Table 1 shows the classification results for the second, third, and fourth experiments on the Brodatz database with 30, 40, and 111 images, respectively. The best result reached using 30 images was 99.84%. In this case, 64 (4 × 4 2 ) random images with size 53 × 53 (213/4) pixels were used for training. It can also be observed that the use of the post-processing step improved the results up to 100% in all cases. These results are higher than the best result, 97.54%, previously published for this experiment on the Brodatz database [1].   The best result reached using 40 images was 99.71%. In this case, 100 (4 × 5 2 ) random images of size 42 × 42 (213/5) pixels were used for training. It can also be observed that the use of the post-processing step improved the results up to 100% in all cases. These results are higher than 95.5%, the best previously published result for this experiment on the Brodatz database [1]. The best result reached using all the 111 images was 97.63%. In this case, 196 (4 × 7 2 ) random images of size 30 × 30 (213/7) pixels were used for training. It can also be observed that the use of the post-processing step improved the results up to 99.88%. These results are higher than the bests result of 98.25% and 99.5% previously published for this experiment on the Brodatz database [30,50].

Brodatz Database
The size of the smaller images reached an optimum for n = 7 with an image size of 30 × 30. We performed an exhaustive search varying from n = 2 to n = 9, reaching an optimum at n = 7. An explanation is that n = 7 is optimal for the complete method using texture and color features. Table 2 compares the results previously published in the literature and our results on the Brodatz database for the four experiments which included 10, 30, 40, and 111 images, respectively.  Table 3 shows the classification results of our method applied to the Vistex database (54 images). Each image in the training set was partitioned randomly, and the number of windows per side was varied from two to four in each image chosen for training, with the number of random images from 4 × n 2 to 10 × n 2 . The first column shows the best results reached by our method, and the second column shows the results after the post-processing stage. Table 4 compares the results published previously in the literature and our results for the Vistex database with 54 images. It can be observed in Table 4 that our post-processed method reached the highest results with 100%.   Table 5 shows the classification results of our method applied to the Outex database (68 images). Each image in the training set was partitioned randomly, varying the number of windows per side from two to four in each training image, and the number of random images from 5 × n 2 to 18 × n 2 . The first column shows the best results reached by our method, and the second column shows the results after the post-processing stage. The best results are highlighted by bold text.  Table 6 compares the results published previously in the literature and our results for the Outex database with 68 images. It can be observed in Table 6 that our post-processed method reached the highest results with 98.97%.  Table 7 shows the classification results of our method applied to the KTH-TIPS2b database (1188 × 4 images). In each test, all the images from one sample were used for training, while the images from the remaining three samples were used as a test set. The first column shows the best results reached by our method, and the second column shows the results after the post-processing stage.  Table 8 compares the results published previously in the literature and our results for the KTH-TIPS2b database with 1188 × 4 images. It can be observed in Table 8 that our post-processing method reached the highest results with 95.75%.  Table 9 compares the results of color features, texture features, and of the combination of both, for texture classification measured on the Brodatz, Vistex, Outex, and KTH-TIPS2b databases. It can be observed that both types of features, color and texture, contribute to the overall results, with maximum performance when both types of features are combined. Comparing these results to those previously published on the same databases, it can be observed that, although the method reached 100% on the Vistex database in Reference [28], the results yielded on Outex were only 94.5%.  Table 10 displays the computational time required for feature extraction (FE), classification time with the SVM, and post-processing (PP) time performed on the Vistex database. All implementations were carried out using Python 3 on an Intel (R) Core (TM) i7-7700HM 3.6 GHz, with 64 GB of random-access memory (RAM).

Discussion
The idea of combining color and texture was proposed previously, but the proposed feature extraction process allows the method to preserve the information available in the original image, yielding significantly better results than those previously published. A possible drawback of previous texture classification methods is that important information is lost from the original image with the feature extraction method, hampering its ability to improve texture classification results. The feature extraction process that includes global and local features is something new from the point of view of combining color with texture. Sub-dividing the training partition of the database into sub-images, and trying to obtain all the information present in the image using various image sizes or a different number of images is something that was not reported in previous publications.
Color and texture features are extracted in order to classify complex colored textures. However, the feature extraction process loses part of the information present in the image because the two-dimensional (2D) information is transformed into a reduced space. By using global and local features extracted from many different partitions of the image, the information needed for colored texture classification is preserved better. Sub-dividing the training data into sub-images (local-global) and trying to obtain all the information present using different image sizes is a new approach.
Although the BQMP method was proposed several years ago [6], it was used in color data compression, color edge detection, and multiclass clustering of color data. The reduction of an image into representative colors and a histogram that indicates which part of the image is represented by these colors achieves excellent results. In addition, local and global features are extracted from each image. The results of our method were compared with those of several other feature extraction implementations on the Brodatz database with those published in References [1,27,28,31,43,44,50], on the Vistex database with those published in References [4,9,13,23,27,28,30,38,45,46,50], on the Outex database with those published in References [4,8,9,11,27,28,30,38,45,46,50], and on the KTH-TIPS2b with those published in References [7,8,31,34,35] (please see Tables 2, 4, 6 and 8). The proposed method generated better results than those that were published previously.
The databases Brodatz, Vistex, Outex, and KTH2b-Tips are available for comparing the results of different texture classification methods. Tests should be performed under the same conditions. We compared our results with those of References [1,7] under the same conditions using the same training/test distribution, and an SVM as a classifier. We also compared our results with those of Reference [4] in which they used a nearest-neighbor classifier (KNN) and, therefore, we tested our method with KNN instead of SVM. The results with KNN are shown in Tables 2, 4, 6 and 8, corroborating that SVM achieves better results. The proposed method achieved better results than those previously published.

Conclusions
In this paper, we presented a new method for classifying complex patterns of colored textures. Our proposed method includes four main steps. Firstly, the image is divided into local and global images. This image sub-division allows feature extraction in different spatial scales, as well as adding spatial information to the extracted features. Therefore, we capture global and local features from the texture. Secondly, texture and color features are extracted from each divided image using the BQMP and Haralick algorithms. Thirdly, a support vector machine is used to classify each image with the extracted features as inputs. Fourthly, a post-processing stage using bagging is employed.
The partition of the image into local and global images provides information about features at different scales and spatial locations within each image, which is useful in color/texture classification. The above, combined with the use of a post-processing stage using a bagging predictive model, allows achieving such results.