OPTIMIZATION OF MANIPULATION LOGISTICS USING DATA MATRIX CODES

In the paper we deal with optimization of manipulation logistics using Data Matrix codes. Our goal is scanning and decoding Data Matrix codes in real-time. We have designed and verified an efficient computer aided method for location of the Data Matrix codes. This method is also suited to real-time processing and has been verified on a test set of images taken from real industrial world. We have proposed a modified, computationally efficient local thresholding technique that uses local mean and variation under the sliding window. The proposed Data Matrix code localization algorithm utilizes the connecting of the adjoining points into the continuous regions and determining of the boundaries of the outer region and it works in two basic steps: localization of the Finder Pattern and verification of the Timing Pattern. Part of the al - gorithm deals also with the decoding of the Data Matrix code using external libraries. Data Matrix codes can be used to mark logistic units, parts, warehousing positions, but also for automated robot navigation. Because of their low cost, accuracy, speed, reli - ability, flexibility and efficiency, as well as the ability to write large amounts of data on a small area, they still have a great advantage in logistics.


INTRODUCTION
Goods identification has always played an important role in trading. Already in the Middle Ages it was necessary to distinguish our own goods from the goods of competitors. When the industrial revolution began and when the batch production was introduced, it was necessary to mark and control a large quantity of goods coming in and out of the factory, so the process of identification had to be accelerated and automated.
In 1932, the first idea of automatic identification of goods was proposed by students of the University of Harvard, USA using punch cards for the automatic despatching of the goods. At present, each product must have its own labelling necessary for production or trade. The arrival of information technology has brought unlimited possibilities for identification. The two-dimensional codes began to be used in the late 1990s in Japan, expanded into the world and became one of the most widespread forms of automatic identification. At present, code systems are used without which large-scale trade and the developed industry would not be possible. Using codes allows automation and thus more efficient results.
The use of two-dimensional codes is one of the most accurate and fastest ways to load a large amount of data. Two-dimensional code technology is all-purpose, reliable and easy to use. Codes can be used in different environments. They can be printed or laser marked on materials resistant to high temperatures, frost, acids, excess moisture, and etc.
Several authors have dealt with code issues. The process of Data Matrix location is based on edge detection, on the connection of the edge points with similar gradient and on searching for the perpendicular regions. This principle is also used by [1], which uses the algorithm to detect linear regions [2,3]. In addition to this approach, other works have been published in the past, such which use Radon transform [4] or Hough transform [5]. Edge detectors in image processing and object classification were also used in work [6]. Waters [7] deals with QR codes and their practical use mainly in business and marketing. Price [8] describes codes in connection with information transfer, communication, and their use in education. Karrach and Pivarčiová [9,10] present and compare several methods for locating Data Matrix codes. Lin [11] undertook to look to the mathematical problem of decoding the 2D barcode. Gaur and Tiwari [12] recognize 2D barcode using edge detection and morphological operations. Li [13] proposed a method of fast code detection. Hansen and Nasrollahi [14] suggested to detect barcodes in real time using method Deep Learning. Szymczyk [15] used RFID sensors and QR and AR markers for navigation in large-format buildings.
An important part of logistics is the process of material handling, which are the operations related to the transport of materials. Transport routes represent a sensitive part of producing and distributing flow, with the potential for traffic and information chaos. This is associated with unpleasant situations where not only distortion or delay can occur, but also information itself can be lost on transported products. This is why the means are being sought to ensure the reliable tracking the objects in the course of logistics and distribution operations. One of the possible solutions for increasing the reliability of information in transport processes is using barcodes which turned out to be successful solution.
The amount of data in the process of handling products and materials during their transportation in the manufacturing or distribution process may vary. Their number can range from ten to thousands of various data. The one-dimensional graphic barcodes (1D codes) are often insufficient to hold the necessary amount of data needed to identify the material being handled. Therefore, they are gradually replaced by two-dimensional graphic codes (2D codes) that allow one barcode to hold much more information than a 1D code.
In the paper we deal with optimization of manipulation logistics using Data Matrix codes. We designed our own algorithm using modified adaptive thresholding algorithm, algorithm of connecting the neighbouring point into continuous areas, and locating Data Matrix codes in two basic steps: Finder Pattern localization and Timing Pattern verification, and of course, the data matrix code decoding is part of the algorithm.
The proposed method has been tested on 60 Data Matrix images laser marked in metal tools and scanned by Logitech C920, Lindner V6 and Raspberry Pi Camera V2.

DATA MATRIX
Data Matrix (DMX) is a two-dimensional matrix barcode of square or rectangular shape made up of black and white square cells that represent individual bits, one cell is called a module. This DMX code can effectively encode alphanumeric data (i.e. data consisting of digits and letters) as well as raw binary data. One single code can contain the product's serial number, the number of packages in the package, the date of manufacture, the date of consumption, etc.
Data Matrix was created by RVSI Acuity CiMatrix, acquired in 2005 by Siemens AG and in 2008 by Microscan Systems. It is standardized according to ISO / IEC16022, International Symbol Specifications, and is public domain, it means, that it can be used by anyone without licenses and fees.
The Data Matrix was designed to store a large amount of data on a small area. On the left and down, the two solid adjacent edges are filled with the black modules (Finder Pattern), on the opposite sides, is alternating the even number of black and white modules (Timing Pattern). The data itself is encoded inside. Unlike other 2D codes, DMX does not use the centre pattern for location of the code. To determine the location and orientation of DMX code the Finder Pattern (an "L" border that has a width of one module) is used. The Timing Pattern is to determine the number of rows and columns. The Data Matrix code sample is shown in Figure 1.
Data Matrix can have up to 30 sizes from 10×10 to 144×144 modules, with a theoretical information density of up to 108 characters per square centimetre. An advantage is the ability to read Data Matrix code even in case of a large code damage up to about 30 %, which is advantageous not only in case of code damage but also when the code is partly covered or if it is glistening.
We can divide the Data Matrix into two subgroups: older from ECC-000 to ECC-140 that could be repaired by convolution and more recent ECC-200s using the Reed-Solomon error correction code.
Data Matrix offers reliability of reading, higher process speeds and quality, so it is often used in logistics and industrial production. It can be used to mark logistic units, parts, warehouse positions, but also to navigate automated robots and increase the reliability of the robot control [16÷20].

LOGISTICS AND CONVEYORS
Logistics is a discipline that deals with the optimization, coordination and synchronizatifigon of all the activities necessary to ensure a flexible and economical production process at optimal cost.
Modern logistics centres are not only focused on constantly expanding the storage capacity of their warehouses, but also on the efficiency and the process of operation throughout storage of individual items in a warehouse. At present, each enterprise tries to optimize logistics processes, material flows and stock [21].
Material handling is an important component of logistics. In handling, this is a summary of operations consisting of loading, transport, transhipment and landing. Other activities concern storage, weighing, packing, sorting, measurement and handling of waste.
Handling material as well as transport determines how quickly a product moves from one place to another. In the modern logistic centres you can find automatic, manual and also intelligent conveyor belts and hook conveyors. In larger warehouses, their use is necessary to accelerate the entire process of loading and unloading or transporting pallets between shelves.
The conveyors provide economic transportation of material and the movement of objects. These are transport equipment serving for the smooth transport of material at shorter distances. They are an assistant in all branches of production, assembly and assembly lines. They are used in the implementation of logistics projects of packing lines, incoming and outgoing warehouse zones. The choice of handling equipment has a significant impact on business productivity and profitability [22÷25].
The primary goal of Data Matrix implementation in logistics is to save time, speed of data input and reduce error rate comparing to the manual input. They are used for tracking and identifying goods, collecting data on processing times, data collection in the production cycle and identification of goods on conveyors.

USING DATA MATRIX IN LOGISTICS
In the paper, we focused on optimizing logistics using Data Matrix codes. The processes of packing and storing can be optimised by marking the products with Data Matrix codes. The main effort is to scan and decode the Data Matrix code in real time. At present, relatively expensive scanners are used, e.g. Zebra, so we designed the cheapest Logitech C920, Lindner Microscope V6 and Raspberry Pi Camera V2 cameras and designed our own algorithm to locate the Data Matrix code in the images. Data Matrix code samples marked with laser on metal tools are shown in Figure 3.

ALGORITHM PROPOSAL
The proposed algorithm uses modified adaptive thresholding technique, algorithm for connection of adjoining points into continuous areas, and Data Matrix localization in two basic steps: Finder Pattern localization and Timing Pattern verifica- We have proposed and tested also a modified local thresholding technique, which combines the local point intensity, the mean and the variance under sliding window and calculates the local threshold as follows: where: m(x, y) -local mean, s 2 (x, y) -local standard deviation of the pixel intensities inside the local window, k 1 -constant, which controls penalisation of bright points, k 2 -constant, which controls decreasing of local threshold for points in which neighbourhood intensity significantly varies.
For Finder Pattern location (finding of two mutually perpendicular line segments of the same length) we adopted the identification of 8 boundary points. In Figure 4 you can see an example of the marked continuous region (in green colour), which is enclosed by red octagon defined by 8 boundary points. There are at least 3 such boundary points which make up vertices of a right-angled isosceles triangle.
We take 8 edge points and make up two boundary squares, which are defined by the following points: From those squares, we select that one, whose perimeter is bigger one (i.e. it represents outer boundary of a continuous region). This way we get 4 border points, which we name P1, P2, P3, P4. In Figure 5 there are outer boundaries marked with solid red line (unlike the red dashed lines, which also connect boundary points, but do not form outer bounding box).
We test these 4 points subsequently taking 3 of them in one testing step. We check whether we can make up a right-angled isosceles triangle. If we do not find 3 such points, we shrink region by 1 point and repeat step once more with new boundary points. If we find 3 such points, we suppose that they are the vertexes of the "L", which define the Finder Pattern. Their location however, is not completely exact, due to inaccuracy of thresholding. This is why we have to get their location more exact in following steps to get the possible best outlines defining the Finder Pattern ( Figure 6).
Once the Finder Pattern is found, we verify if the two opposite sides correspond to the Timing Pattern, where the black and white modules alternate. Maybe the bounding box does not define   Fig. 7. Projection along the Timing Pattern exactly the DMX code, so we have to look for a sequence of black and white modules in the wider surrounding of the initial bounding box. We do it by testing several adjacent positions and looking for the optimum (Figure 7). The optimum is defined as the maximum of sum of pixel intensity gradients. And the number of transitions between black and white modules is searched as the number of local extremes. If the number of modules is at least 10 (minimum DMX size) and is the same in both directions (both vertical and horizontal) we have found the valid DMX code.

RESULTS ACHIEVED
The method mentioned above was tested on the test set consisting of 60 samples of DMX codes marked with laser on metal tools, which were scanned by three different cameras. In the first round the location of the images in the original size was made. In the second round the images, where location failed, were resized to 75% of the original size and the location operation was repeated. In Figure 8 are the results of the Data Matrix code location, in Figure 9 are the results of decoding the localized Data Matrix code.
As can be seen from Figure 8 and Figure 9, the results of locating and decoding the Data Matrix codes obtained by the Lindner microscope V6 were poor. With the images of 100% size, material errors were highlighted and the Data Matrix code was not correctly recognized. After we smoothed the image with the 3 × 3 Gauss filter, we got better results. Next after resizing the image to 75%, we've got a smoother image and we've gotten still better results. We can achieve the best results by combining smoothing and appropriate size change.

DISCUSSION
We proposed and tested the computationally effective method for locating the Data Matrix in the images. This method is also suited to realtime processing and has been verified on a realworld set of images. The suggested method uses typical patterns of Data Matrix codes i.e. Finder Pattern and Timing Pattern, local thresholds,  We also proposed a modified, computationally efficient adaptive thresholding technique that uses local mean and variance under the sliding window. This technique has achieved significantly better results in special cases that we have to solve than classical adaptive thresholding method that use only local mean and delta constant. We have shown that image resolution has impact on recognition rate and we have also shown that the iterative image rescaling and following recognition can further improve results.
The most common causes of localization failure were the structure of the material on the surface of instruments that caused reflection of the light and consequently caused the incorrect results in the adaptive thresholding. As a solution how to overcome these problems, we've improved local thresholding with a equation (1). This technique, unlike the commonly used Niblack and Sauvola techniques, does not require a square root calculation for each point to calculate a standard deviation, and is less sensitive to the selection of the k parameters.
When deploying the proposed method, it is necessary to resolve the problem of scanning of the image, because many commonly used cameras, mobile phones and tablets have auto-focus to focus on the object in front of the lens, and it takes some time to focus on the image, which appears in normal operation as a disadvantage, because the shooting is not smooth.

CONCLUSIONS
Data Matrix is used in many areas of everyday life, we encounter them in shops, offices, warehouses, and scientific workplaces. They serve to identify goods, documents, products, consignments or tools. Their main benefits are speed and low cost of identification, so they are also expanded in industry, food, automotive, and electrotechnics. They are used to designate different parts and, spare parts, especially in complex logistics areas where there is a high demand for precise and rapid transfer of information about the state of production and storage.
Due to the high density of writing on a small area, they are suitable for use on small objects such as processors, chips, electronic components, military applications, and so on. Data Matrix Codes are most suitable for use in logistics. Logistics involves a number of activities whose task is to have the right object at the right time in the right place in the required quantity and quality with the necessary information at the right price. In the future, Data Matrix codes could replace RFID technology, which hitherto hints at high introductory costs and the need for project solutions. The low cost, accuracy, speed, reliability, flexibility, productivity and efficiency, as well as the ability to write large amounts of data on a small area, is still a great advantage of Data Matrix Codes in Logistics.