International Journal of Engineering and Information Systems (IJEAIS) ISSN: 2000-000X Vol. 2 Issue 3, March – 2018, Pages: 36-46 www.ijeais.org 36 Design of Label Sorting Algorithm Program as Batik Pattern Drawer with Euclidean Distance Method Budi Setiyono 1 , Sumardi 2 , and Solichul Huda 3 Electrical Diponegoro Departement, Diponegoro University, Semarang, Indonesia 1 budisty@gmail.com, 2 sumardi.undip@gmail.com, 3 umyhugi94@gmail.com Abstract: The development of technology pushes human to increase productivity by changing manual system to automatic system. Modernization affect almost all aspect especially in art. Batik is a ancestor legacy of indonesian people that recogized by UNESCO as culture legacy of Indonesia yet batik industries are not develop as much. Modernization in batik art is expected to optimize its productivity.This research design algorithm and the program in MATLAB that used for controlling movement protype of batik maker 2 dof cartesian robot. The input data is a picture that will be processed to obtain the order of coordinate edge. Then it procesed and sent to plantby using MATLAB based on Graphical User Interface (GUI). The 2 dof Cartesian robot and a pen (end effector) is used to draw a pattern. A servo motor is installed to activate end effector and two stepper motor coupled with thread mechanic that used to move it towards the X and Y axis. Testing is done by sending coordinat orders to the plant or by observing drawing process order. Obtained error from program and algorithm testing is 2,32% . Keyword: Batik, Matlab, GUI 1. INTRODUCTION Indonesia is a country which has rich in art and culture. Indonesia has a lot of diversity in art especially painting and batik. Almost every region in Indonesia has a unique batik motifs according to the characteristics of their respective areas ranging from batik Cirebon, Pekalongan, Solo, Yogyakarta to batik Ubud in eastern Indonesia. Therefore, the world recognizes that batik is an original asset of Indonesian culture. Batik Indonesia is one of the world cultural heritage (World Heritage) which has been recognized and endorsed by United Nations Educational, Scientific, and Culture Organization (UNESCO) on October 2, 2009 [1]. The rapid technological developments in the world have an impact on advancements in various fields including development in robotics and industry. Technology advancement keeps pushing people forward to increase productivity especially on industry, we start to replace manual system to automation system [2]. Industrial world closely related to the world of robotics almost every industry uses robotic applications in running its production activities. Among the types of robots that are widely used in industrial productivity are the cartesian robots. The cartesian robot in its design has a structure consisting of three linear (prismatic) axes. Each axis can move into the X-Y-Z axis making it possible to get more accurate results in drawing batik patterns [3]. However the modernization of the art industry in Indonesia is not common. Modernization in the field of art, especially on fine art, closely related to the quality of image processing which enable wider application in various fields of high technology [4]. Graphical User Interface (GUI) in addition to being used as interaction between the user and the plant also allows it to be embedded with image processing program. In previous research has been discussed about a robot designed to cut styrofoam automatically with two degrees of freedom. In this research the plant runs based on chain code algorithm program designed using Borland Delphi 7 software. By developing the concept of previous research, in this research will be discussed about design algorithms that build the program language with MATLAB Graphical User Interface ( GUI) and generate coordinated sequential data output. The output will be processed in Arduino Uno microcontroller and it will move the plant in the form of prototype of cartesian robot in drawing batik pattern. It will be expected from this research to get program algorithm in MATLAB that allows plant to draw batik motif and pattern more accurate. 2. GUI A GUI (Graphical User Interface) is a graphical display that contains a device or component that allows users to perform interactive tasks. Users do not need to create a script or write a command on the command line to perform a task [8]. GUI components can be menus, toolbars, push buttons, radio buttons, list boxes, sliders, and more. Matlab GUI can also display data in the form of tables or plots, and can be grouped with related components. A simple GUI example with Matlab can be seen in Figure: International Journal of Engineering and Information Systems (IJEAIS) ISSN: 2000-000X Vol. 2 Issue 3, March – 2018, Pages: 36-46 www.ijeais.org 37 Fig. 1. A simple GUI example with Matlab. 2.1 Euclidean Distance Euclidean distance is the most common type of cluster analysis distance measurement that used to measure the distance from a data object to the center of cluster. Euclide distance is the geometric distance between the two data objects. The closer the distance, the more similar the data object. In the general form of euclide distance (d) can be obtained by: x = ( , ,....., ) (1) y = ( , ,....., ) (2) In two dimensions, for example there are 2 coordinate points (x1, x2) and (y1, y2) as in the following figure : Fig. 2. Cartesian coordinates. 2 21 2 21 )()( yyxxd  (3) Or it can also be established that [13]     m k j m k kie kfdd 1 2 1 , )( (4) de = euclidean distance fdi = data training International Journal of Engineering and Information Systems (IJEAIS) ISSN: 2000-000X Vol. 2 Issue 3, March – 2018, Pages: 36-46 www.ijeais.org 38 kj = test data m = amount of data training 2.2 Feature Extraction of Canny Edge Detection Feature extraction is important in making of machine learning for classification or pattern recognition, which is information from the image can be obtained. One of them is edge detection. Edge detection is the first step to encompass the information within the image. The edges characterize the boundaries of the object and therefore the edge is useful for segmentation and identification processes within the image. The purpose of edge detection is to increase the appearance of the boundary line of an area or object in the image. The edge is a change of the intensity value of abrupt gray (large) in a short distance. The feature extraction of canny edge detection method is one of the modern edge detection algorithms invented by John F. Canny in 1986. In the following figure is the steps to perform canny edge detection [12]: Start Digital image input Change the image to grayscale Gaussian filter implementation Calculate the magnitude gradient Determining the edges Non maximum supression Hysterisi thresholding Image edge detection results End Fig. 3. Flowchart of canny edge detection process. 2.3 Software Design GUI (Graphical Interface Unit) is created to facilitate the user in running the process. In the design, this GUI design will be built several panels that are tailored to the function of each panel. The flowchart to build this GUI is: International Journal of Engineering and Information Systems (IJEAIS) ISSN: 2000-000X Vol. 2 Issue 3, March – 2018, Pages: 36-46 www.ijeais.org 39 Start Click "BUKA FILE", input Image.jpg Resizing 250x250 Edge detection (canny) RGB to BW Coordinate Transformation Coordinate to G-Code Click "Kirim" Serial Communication Disconnect? Data Received ? End Yes No Yes No Yes No Serial Communication Connected? Connector Serial Communication Fig. 4. Flowchart flow of GUI main program use. International Journal of Engineering and Information Systems (IJEAIS) ISSN: 2000-000X Vol. 2 Issue 3, March – 2018, Pages: 36-46 www.ijeais.org 40 Fig. 5. Main program display. Figure 5. shows the components that build the prototype of batik GUI, including serial communicating panels that work for serial connection, image processing panel to perform commands on image processing, the execution panel contains advanced commands after the completion of the process if the image, graphic input image, canny image graph, process graph to find out the order of depiction, then the info panel to find out the number of labels and dots detected by the program. Start Binner image input Labelling Look for the coordinates of the starting and ending points of each label Calculates the closest distance of the label with euclidean theorem Sort and sort labels with the closest distance Sorting coordinates according to the order of the labels Provides bulkhead separators between labels Coordinate aggregate End Fig. 6. Flowchart sorting coordinates. International Journal of Engineering and Information Systems (IJEAIS) ISSN: 2000-000X Vol. 2 Issue 3, March – 2018, Pages: 36-46 www.ijeais.org 41 The above flowchart can be spelled out into a few explanations below. Among others are: 1. Labeling Process After the RGB image (red green and blue) is resized to 250x250 pixel size and determined by using edge detection of canny type, black and white image (BW) was created in the form of white contour edges that read as logic "1" while the black color will be detected as logic "0". The edge contours with their respective logic are present in the 250x250 pixel matrix, then the adjacent logic 1 form a plane or line will be classified into one label so as to obtain a number of labels in an image. The system assigns a label to a field or line on the pixel dimension of the matrix. 2. Search for starting point and end point of any number of labels In this process the system will search the edge of a label located within any pixel coordinate. After obtaining the coordinates of the label edge, the next step is to take the coordinates of the starting point and the coordinates of the endpoints of one label until the end of label. So the data can be obtained from the starting point and end point sequence. 3. Calculate the distance of the nearest label Since the coordinates of the starting and ending points on each label obtained, the system will calculate the distance between the starting point of one label and the endpoint of the other. The label sequence is determined by the distance that has the smallest value between the end of the initial label and the second label starting point. Then make a comparison between those points. Therefore once the sequence of labels along with their coordinate sequence obtained then the system will create a separator mark between labels. This is done with the purpose that the pen drawer (end effector) on the plant is able to distinguish when it will lower the drawing pen and when it will lift the drawing pen. The created coordinates indicate the lifting of the pen are (0,0), then it can be concluded that the coordinate between the labels is (0,0). 3. RESULT AND ANALYSIS In this sub-section the testing is done by find out the correctness of the algorithm that has been made by sending Matlab output data to the plant so that it will produce the result image. Testing is done by interpreting the basic build pattern of batik motif that has been selected. Testing is done by following the steps according to the flowchart that has been discussed in the previous section. 3.1 Circle Shape This test uses input data in the form of image files with the file type. JPG with the default pixel size. The pixel size is then resized to a random size of 250 x 250 pixels as shown in Figure 7. Fig. 7. of the circle image by the pen (end effector) plant. Table 1. Boundary coordinate data on the circle Diameter Start Coordinate End Coordinate Digital Picture Diameter (Length unit) Plant Picture Diameter Info dv (2, 125) (248,125) 246 32 mm Match dh (124,3) (124, 249) 246 32 mm Match International Journal of Engineering and Information Systems (IJEAIS) ISSN: 2000-000X Vol. 2 Issue 3, March – 2018, Pages: 36-46 www.ijeais.org 42 With regard to some things, if the dimensions of the image are not reduced will cause the plant to work is not maximal, then the dimension of the image is reduced from 37 mm x 37 mm to 33 mm x 33 mm by adding a big dividing factor in Matlab. From the data Table 1 it can be seen that the dimension of the maximum drawing range of the plant is 33 mm x 33 mm and the success condition can be known by paying attention to the magnitude comparison of symmetry. The diameter of the vertical and horizontal sides shows the same value in both the 246 Unit length and the 32 mm picture, the percentage of system success can be summarized 100%. 3.2 Square Shape This test uses input data in the form of image files with the file type. JPG with the default pixel size. The pixel size is then resized to a random size of 250 x 250 pixels as shown in Figure 8. Fig. 8. square image results by pen (end effector) plant Tabel 2. Boundary coordinate data on square Diameter Start Coordinate End Coordinate Digital Picture Diameter (Length unit) Plant Picture Diameter Info dv (6, 243) (6,6) 237 30 mm Match dh (6,243) (243, 243) 237 30 mm Match With regard to some things, that if the dimensions of the image are not reduced will cause the plant to work is not maximal, then the dimension of the image is reduced from 37 mm x 37 mm to 33 mm x 33 mm by adding a big dividing factor in Matlab. From the data Table 2 it can be seen that the dimension of the maximum depiction range of the plant is 33 mm x 33 mm and the success condition can be known by paying attention to the magnitude comparison of symmetry. The diameter of the vertical and horizontal sides shows the same value of both the digital image of 237 Unit Length and the 30 mm plant image, the percentage of system success can be summarized 100% 3.3 Triangle Shape This test uses input data in the form of image files with the file type. JPG with the default pixel size. The pixel size is then resized to a random size of 250 x 250 pixels as shown in Figure 9. International Journal of Engineering and Information Systems (IJEAIS) ISSN: 2000-000X Vol. 2 Issue 3, March – 2018, Pages: 36-46 www.ijeais.org 43 Fig. 9. triangular image by pen (end effector) plant Tabel 3. Boundary coordinate data on triangles Diameter Start Coordinate End Coordinate Digital Picture Diameter (Length unit) Plant Picture Diameter Info dv (126,248) (126,2) 246 32 mm Match dh (3,248) (249, 248) 246 32 mm Match With regard to some things, that if the dimensions of the image are not reduced will cause the plant to work is not maximal, then the dimension of the image is reduced from 37 mm x 37 mm to 33 mm x 33 mm by adding a big dividing factor in Matlab. From the data Table 3 it can be seen that the dimensions of the maximum depiction range of the plant is 33 mm x 33 mm and the success condition can be known by paying attention to the magnitude comparison of symmetry. The diameter of the vertical and horizontal sides shows the same value in both the 246 Unit Digital and the 32 mm picture, the percentage of system success can be summarized 100%. 3.4 Testing Batik Pattern Making This test uses input data in the form of image files with the file type. JPG with the default pixel size. The pixel size is then resized to a random size of 250 x 250 pixels as shown in Figure 11. Fig. 10. Original image that has been resized to 250 x 250 pixels. Fig. 11. Image edge detection results from the original image processing International Journal of Engineering and Information Systems (IJEAIS) ISSN: 2000-000X Vol. 2 Issue 3, March – 2018, Pages: 36-46 www.ijeais.org 44 Fig. 12. Results of coordinate sequence processing algorithms with canny image input. Fig. 13. The result of the depiction by the plant. By analyzing Figure 10, Figure 11, Figure 12, Figure 13 it can be concluded that edge detection, which is the default Matlab algorithm capable of converting RGB image into edge image as shown in Figure 11 and the canny image is an input for the coordinate sequencing algorithm using the euclidean method. Under ideal conditions, Figure 12 will have the same result as Figure 13 but in Figure 13 there are several straight lines that are not identified as labels also drawn. This is because lack of program conditions on microcontroller and lack of stabilization on mechanical installation. Therefore the error when drawing the label can be expressed as follows: %100 _ __ (%) x idealnilai idealnilaiaktualnilai Error   %100 43 4342 (%) xError   %32,2(%) Error Maka dapat disimpulkan error program adalah 2,32% 4. CONCLUSION Based on testing and analysis that has been done, it can be concluded several things as follows: Designed algorithms have been successfully simulated on both the GUI chart and on the Cartesian robot plant. The prototype of cartesian robot maker of batik pattern based on Graphical User Interface has been successfully designed by generating program error of 2.32%. Graphical User Interface as a cartesian robot interface has been successfully designed and all functions work properly. The interface is designed with data transfer rates of 9600 bits per second. The prototype of the cartesian robot succeeds in making archetypal patterns of square, circle, and triangle and pattern of flower batik motifs. International Journal of Engineering and Information Systems (IJEAIS) ISSN: 2000-000X Vol. 2 Issue 3, March – 2018, Pages: 36-46 www.ijeais.org 45 REFERENCES [1] UNESCO, "Evaluation of the nominations for inscription on the Representative List of the Intangible Cultural Heritage of Humanity," 2009. [2] D. Z. Aridanana, E. Sunarno, dan M. Safrodin, "Rancang Bangun Konveyor Untuk Sistem Sortir Berdasarkan Berat Barang," Laporan Tugas Akhir, Politeknik Elektronika Negeri Surabaya, Surabaya, 2010. [3] Pitowarno, Endra, (2006). Robotika: Desain, Kontrol, Dan Kecerdasan Buatan. Buku Teks. Yogyakarta: ANDI. 1-3 [4] V. Kale dan V. Kulkarni, "Object Sorting System Using Robotic Arm," Int. J. Adv. Res. Electr. Instrum. Eng., vol. 2, no. 7, pp. 3400–3407, 2013. [5] __, Matlab 7 Greating Graphical User Interfaces. MathWorks, Inc., 2007. [6] Dr. Raden Supriyanto, dkk, Buku Ajar RobotikaKata Pengantar, 2010, Gunadarma University [7] Johnson, A. R dan Dean W.Wichem. 2002. Applied Multivariate Stastitical Analysis. Edisi ke-5. New York: Prentice-Hall, Inc. International Journal of Engineering and Information Systems (IJEAIS) ISSN: 2000-000X Vol. 2 Issue 3, March – 2018, Pages: 36-46 www.ijeais.org 46 Authors Budi Setiyono, born in Purbalingga on May 21, 1970, completing his undergraduate and master's degrees in the Electrical Engineering Department of Gadjah Mada University in the field of Electronic Signal Processing. Become a lecturer in Electrical Engineering Department Diponegoro University since 2000. The field of science is a technique of automatic control with specialization in modeling and intelligent Control Sumardi, born on November 11th 1968 in Sukoharjo, Central Java. Graduated as a bachelor in Diponegoro University, Semarang, majoring in Electrical Engineering, Faculty of Engineering, in 1994. Got a master degree in 1998, majoring Instrumentation and Control Engineering Physics Program, Institute of Bandung Technology. Has followed some trainings including PLC training organized by OMRON as PLC producers and digital signal processing training organized by Institute of Bandung Technology. Has done some researches such as "Perancangan Sistem Kontrol Suspensi semi-aktif menggunakan Fuzzy Logik Control pada Model Kendaraan Seperempat", "Pengembangan Sistem Peringatan Dini Banjir berbasis SMS dan Web Studi Kasus Sungai Garang Semarang", and also has cooperated in the installation of flood early warning instrument with PT Jasa Tirta, BBWS Southeast Sulawesi, etc. Current busyness is as a lecturer and researcher at Electrical Engineering Department, Faculty of Engineering, Diponegoro University, Semarang, Indonesia. Solichul Huda, born on October 16 th 1994, in Kebumen, Central Java. Graduated as a bachelor in 2018, majoring Electrical Engineering, Faculty of Engineering, Diponegoro University.