Feature extraction in batik image geometric motif using canny edge detection

a Informatic Engineering Department of Politeknik Harapan Bersama Tegal, Mataram Street No.9, Pesurungan Lor, Margadana, Tegal City, Central Java 52147, Indonesia b Information System Department of STMIK YMI Tegal, Pendidikan Street No.1, Pesurungan Lor, Margadana, Tegal City, Central Java 52122, Indonesia 1 fikri@poltektegal.ac.id*; 2 nishom@poltektegal.ac.id; 3 slamet2wiyono@gmail.com; 4 yustia.hapsari@gmail.com * corresponding author


I. Introduction
Batik is one of the typical Indonesian cultural heritage, since October 2, 2009, UNESCO has recognized that batik is the intellectual property of the Indonesian people [1]. Batik is having so many diverse motifs in each region. Each batik's motifs have unique characteristics, such as patterns, images, colors, ornaments, and variations. These different motifs can be found in Cirebon, Tegalan, Pekalongan, Solo, Yogyakarta, and Kraton batik.
The wealthiness and the character of batik are located in its motif. However, many people do not know about the batik's motifs. There are only a few (certain) people who can recognize the motifs of each batik well. Knowing and understanding the motifs that exist in batik means be participating in maintaining the nation's cultural heritage. Furthermore, this is following the mandate of the constitution of the Unitary Republic of Indonesia. Some researchers have made models to recognize batik motifs automatically. Through the built-in architectural model, someone does not necessarily have specialized knowledge about batik motifs. All knowledge about batik motifs has been incorporated into the model. Yodha and Kurniawan made a batik detection application using the K-NN algorithm and Canny edge detection [2]. Other applications for recognizing batik motifs using Canny's edge detection and Matching Templates have also been developed by Flaurensia et al. [3]. While Pebrianasari conducted a particular study by analyzing the introduction of Pekalongan batik motifs using the Backpropagation algorithm [4], these studies can automatically recognize batik motifs.
The research focusing on the feature extraction stage conducted by Fanani [5] using the cardinal spline curve is represented for the calculation of geometric values. Feature extraction carried out in that research is in the Klowongan and Isen-Isen batik motifs. The value generated from the feature extraction can be used for input at the classification stage of the introduction of batik motifs. Kurniawardhani [6] has also researched by extracting features of batik motifs that are invariant to rotation. The main objective of this research is to create a reliable model when it uses for image classification from various sources.

A B S T R A C T
One of Indonesia's priceless cultural heritages is batik. Even UNESCO was admitting that batik is an intellectual, cultural right of the Indonesian (October 2). Unfortunately, many Indonesian do not have sufficient knowledge about the various types of the existence of batik's motifs. In fact, in each of these motifs, many treasures must be maintained. Therefore, it is necessary to develop a model that can recognize batik motifs automatically. The model can be built using various kinds of pattern recognition algorithms. One of the most important stages in the introduction of batik motifs is the feature extraction. Feature extraction is needed to determine the parameters that able to define character a batik's motif. One feature extraction model that can be done is by using edge detection. This research focuses on feature extraction using Canny edge detection. The result of edge detection is forming the pattern of a batik motif. The pattern contains pixel values 0 and 1. These values can later be used as input at the classification stage. An important stage before classifying batik motifs is the feature extraction phase. In this stage, it is very influential in determining classification reliability. Feature extraction is used to extract features of an image object. For instance, as the feature of the face, it has eyes, nose, mouth, eyebrows, and hair. These features can be used to detect face objects in image processing. Likewise, in batik's motifs, several features can be used to recognize the batik's motifs, such as style, texture, color, and shape. When the feature is extracted, it can be used to recognize the motives of each batik. One of the features of the feature extraction that can be done is the edge detection method. Canny edge detection is one of the reliable and effective edge detection methods [7] [8], developed in 1986 by John F. Canny [9]. This edge detection method can be used to extract batik features.
Batik motifs are generally divided into two types, namely geometric and non-geometric motifs [10]. Geometric motifs are motifs whose structure follows geometric patterns, such as squares, circles, kites, and triangles. While non-geometric motifs are batik's motifs whose composition is irregular, this research will only use batik with geometric motifs.

A. Canny Edge Detection Method
John Canny proposed the Canny edge detection method in 1986 in his paper, A Computational Approach to Edge Detection [9]. The paper describes a computational approach to edge detection. The Canny method uses the concepts of first and second derivatives in a very effective way. This method applies a gradient approach to edge detection by removing noise with a Gaussian filter and also combines elements of the Laplacian approach. This method has three simultaneous objectives: a low error detection rate, good edge localization, and only one detection response per edge. Canny assumed that false-positive and false-negative detection errors were both undesirable and gave them the same weight. Canny further assumes that each edge has a nearly constant cross-section and orientation, but his method only effectively handles edges and curved corners. With this constraint, Canny determines the optimal 1D edge detector to move forward and shows that derivatives from Gaussian [11] can reasonably well estimate his impulse response.
For 2D images, the Canny edge detector consists of three stages. The first stage is smoothing f (x, y) images with an isotropic 2D Gaussian G. Second stages find zero-crossing from the second-order direct derivative of the image in the direction of the gradient. The third stage saves the zero-crossing and state as edge pixels if connected and have edge strengths that pass double threshold hysteresis criteria [11]. Fig. 1 shows the results of image processing using double threshold hysteresis. Technically, the Canny method does at least five steps in edge detection [12]. These stages are Gaussian Filter, Calculation of Gradient, Non-Maximum Suppression, Double Threshold, and Edge Tracking with Hysteresis.

B. Gaussian Filter
Canny edge detection method in reducing noise is using a Gaussian filter. Gaussian filters use image convolution techniques by applying the Gaussian Kernel (3x3, 5x5, 7x7, etc. ...). The size of the kernel depends on the expected blurring effect. Equation (1) for Gaussian filter kernel size (2k + 1) × (2k + 1).

C. Calculation of Gradient Intensity
The gradient calculation is done by comparing the intensity and direction of the edge by calculating the gradient of the image using the edge detection operator. Relationships between edges are used to change the pixel intensity. The easiest way to detect it is to apply a filter that improves this conversion in both directions: horizontal (x) and vertical (y). When the image is smoothed, the derivatives of Ix and Iy with x and y are calculated. It can be implemented by implementing I with the Sobel Kx and Ky kernels (as shown in (2)).
Then, the magnitudes of G and the slope θ of the gradient are calculated by (3), (4).

D. Non-Maximum Suppression
Non-maximum Suppression is used to produce a thin final image by performing non-maximum Suppression through thinning the edges. The principle is simple. The algorithm passes through all points on the gradient intensity matrix. Then it finds pixels with maximum values in the direction of the edge.

E. Double Threshold
The double threshold phase aims to identify three types of pixels: strong, weak, and irrelevant. Strong pixels are pixels with very high intensity, so we believe they contribute to the final edge. Weak pixels are pixels that have insufficient intensity values to be considered reliable but are not small enough to be regarded as irrelevant for edge detection. In contrast, other pixels are deemed unimportant as edges.

F. Edge Tracking with Hysteresis
Based on the threshold results, hysteresis consists of converting the weak pixels to the strong pixels, until at least it meets one pixel around the pixel processed is strong, as explained as Fig. 2.

III. Method
This study only reached the initial stage of batik feature extraction, not the classification stage. Feature extraction is done using the Canny edge detection method. The value generated from this edge detection can be utilized in the next step, which can provide quantitative values in the form of a vector with the N dimension. This value represents the characteristic of the image. Therefore, the stages of this research methodology are not so different from the steps in Canny's edge detection method (as shown in Fig. 3).

A. Dataset
The collections of batik's images with the geometric motifs are utilized as datasets that its feature to be extracted. As it is shown in Fig. 4, the total datasets are ten images.

B. Preprocessing
Preprocessing is done by changing the original image into a grayscale image. The purpose of this conversion is to create a new image with only a color's space. Therefore, the ease in calculating pixel values achieve.

C. Edge Detetction
The edge detection is implemented by the Canny method. The main purpose of this stage is to extract features. The value is obtained from the edge detection results can be used for input parameters of the classification algorithm. This edge detection stage starts from the stage of using a Gaussian filter on a grayscale image, calculation of gradient intensity, Non-Maximum Suppression, determination of double threshold values, and Edge Tracking with Hysteresis. The final stage of this series is obtaining a new image that is only displaying the edge area of a batik image.

IV. Result and Discussion
All geometric motifs batik's image datasets are carried out one by one edge detection process. The results of the edge detection stage can be seen in Table 1. The original image in the form of an RGB image is converted to a grayscale image. This conversion stage is common in an image processing operation. This process aims to facilitate the operation process at the next step. This conversion is processed by changing the RGB image, which consists of three color channels (red, green, and blue) to only a color channel. One-color channel makes it easier to use on the image processing operations. Once it is converted into a grayscale image, the next step is to refine it with the Gaussian filter. Gaussian filter at this stage is used to reduce the noise in an image. The last step in a series of steps is to detect Canny's edges. The image produced from Canny's edge detection can be seen in Table 1. The image consists of pixels with both values 0 and 1. The values of 0 and 1 are forming a pattern of a batik motif. This result of this pattern detection can later be used as a reference value in the classification of batik's motifs according to the algorithm used. The results of edge detection using the Canny operator can later be used as training data in forming a knowledge base to recognize batik motifs.

V. Conclusion
The Canny method is proven to be able to detect edges well on geometric motif batik images. The results of the detection assemble the pattern of a batik's motif that already being tested. The information from the pattern result can later be used as training data in building a knowledge base to recognize batik's motifs.