The Effectiveness of Image Preprocessing on Digital Handwritten Scripts Recognition with The Implementation of OCR Tesseract

Optical Character Recognition (OCR) has been widely discussed in various topics in the rise of robotics, artificial intelligence and computer vision. OCR has become a solution in extracting characters from the image into machine-encoded text. This research aims to discuss character recognition from digital handwritten image. However, characters recognition problems using OCR has been more or less solved. OCR mainly implemented in reading characters from scanned of printed documents. In this research, image preprocessing including convert to grayscale, morphological operations and noise removal has been successfully boost the accuracy score of OCR performance. The average success outcome resulted to 79.26% in reading characters from the image.


INTRODUCTION
Optical Character Recognition (OCR) is the process of reading text from printed or scanned-handwritten document. Nowadays, OCR already implemented in extracting filled forms, passports, ID cards recognition, license plate, etc. [1] [2]. Not only in desktop application, by uploading or capturing the image, OCR has been widely implemented in smartphones. The quality of image-input become a major factors of recognition performance and affects the accuracy rate of OCR [3] [4].
Even though the data in digitization format, there are challenging issues such as the image noise, different handwriting style, different type and font sizes, not aligned, etc. is become the major problems in recognizing characters. There are many OCR engine available and consistently updated newer version such as Tesseract, Google OCR, ABBYY FineReader, FreeOCR, etc., however, Tesseract stands out of all OCR engines [5]. Tesseract supports in Windows, Linux and MacOS. Tesseract provides 120+ models data trained language data files which already applied the new LSTM neural net-based engine. Tesseract also can process right-to-left text such as Arabic or Hebrew [6].
Tesseract is an open-source OCR engine that was developed by HP between 1984 and 1994. Tesseract was first started as a PhD research project. In the year 2005, Tesseract was released by Hewlett Packard and University of Nevada, Las Vegas. Now, partially Tesseract engine funded by Google and released under the Apache license, version 2.0. The lastest version, Tesseract 4.x is released in December, 2019. Tesseract engine implemented the key functional modules such as: This paper is organized as follows: Section 1 explained briefly about Optical Character Recognition (OCR). In the Section 2 we discussed a brief overview of related work and also we explained the proposed method of our research in Section 3, the experiments of the research are described and discussed in Section 4 before we conclude in Section 5.

RELATED WORK
Many researchers implemented various techniques of combination preprocessing for different types of character. For non-latin characters, in 2020, Anuradha et al. consists three main stages of recognizing Sinhala characters: preprocessing, recognition process and postprocessing. Their preprocessing proposed the techniques such as image binarization, noise removing, skew detection and correction, normalization and segmentation. The accuracy rate of reading Sinhala characters including the complex characters has achieved between range 80% -90% [10]. In 2016, Qi Li et al. using five steps: trainned chinese characters data, dilation, erotion, image enlargement and reduction in the image. Their proposed methods using scanned handwritten chinese characters that reach the highest accuracy of all samples 64%. Meanwhile, the recognition accuracy rate of each chinese characters is over 92% [11]. In 2011, Kumar et al. implemented digitization the indian scripts as their input being converted into scanned document. The preprocessing using 3 steps: skew detection/correction, skeletonization, and noise removal/reduction. And also, the important steps such as: segmentation, feature extraction and classification applied [12].
Moreover for latin characters, in [4] use captured label of counterfeited products as their dataset. The preprocessed methods they used are : image binarization, noise reduction, image sharpening and image cropping. They calculate the accuracy for each methods, noise reduction: 78%, sharpening image: 76%, image cropping: 73% and binarization: 82%. In different methods, Sandip et al. applied labeling training data and segmentation in scanned Roman scripts. They test for total 1844 training sets and reach highest accuracy 83.50% [13].
Furthermore, character recognition problems using OCR has been more or less solved. The reserachers combining different type of technique preprocessing considering can produce high quality input for OCR prosess. This research aims to process in recognizing handwritting latin scripts with the combination of preprocessing technique such as: convert into grayscale, morphological operations, and noise removal. The details of proposed methods will be discussed in the next section. Figure 2. Illustrates the proposed method of this research was implemented in the following stages. The method is divided into three phases, i.e., input, process and output.

DATASET PREPARATION
This research developed a canvas in order to make a dataset of digital handwritten text. This feature capable of doing free-flow writing in website. This feature is developed because the author facing limitation in finding digital handwritten text dataset collection. In the previous study, the researchers used scanned of handwriting image as their dataset [3][12][14] [15]. With total of 50 sets of image format digital handwritten image including the total of 323 characters as the dataset of the research. The image contains pixels, fuzzy, grainy in the edge, to achieve the high qualities input for OCR process, we implemented the preprocessing step that described in Section 3.2.

PREPROCESSING
Preprocessing is subjected as the initial stage of image processing before sent to the OCR process. We investigated the preprocessing techniques including convert into grayscale, basic morphological operations: erode and dilate, and noise removal need to be performed.

CONVERT INTO GRAYSCALE
First, converting the image into grayscale from the blue color text on the image. By setting the gray-level in averaging the intensity level of three colors pixel.
This process aims to differentiate the pixel noise in the image. The grayscale image is easier to work in morphological operations than color image [16].

MORPHOLOGICAL OPERATION
Morphological operation is to filter the image by replacing the convolution operation by the logical operation. The basic set of morphological operations are erosion and dilation that processed the images based on shapes. This process aims to isolate the individual elements and joining disparate elements in the image, finding intensity bumps and holes in the characters, smoothing contours, thin characters, and extracting the boundaries [17]. Moreover, morphological operations can be successfully implemented in handwritten text due to erratic hand and movement and different handwriting style [18].  In details, Figure 4. the words of 'O' rounded by holes in the edge of the word. After the process of erode and dilate ( Figure 5. and Figure 6.), the holes and bumps are reduced. The output of morphological operations made the word into an accurate shape than before preprocessing.

NOISE REMOVAL
The last step of preprocessing is noise removal. The output of morphological operations still contains noise, so that the pixels that are not needed can be eliminated. Using median blur operations, the central element of image is replaced by the median of all pixels in the kernel area. In details of Figure 7. The character of 'M' shows a bump at the bottom. Performing noise removal operations, the bumps eliminated and produce an accurate shape of 'M'. Furthermore, the usability of image preprocessing improves the character level which has an important role in OCR process recognizing in word level. Tesseract engines provide additional language regarding the language used. This research implemented the tessdata/eng.trainned data trained model as the dictionary of existing word in English. Figure 8 shows the process of Tesseract engine [5]. First, page layout analysis is for detecting the text area in the image. Second step, dividing the detected text area into a series of blobs. The blob is categorized as a classifiable unit, which may contain several characters or may contain a part of some character. The third step is to define the text lines and to combine the blobs into a series of words according to the blank space [19]. These three steps are prepared for the word recognition. The next step is to recognize each word in two passes. On each pass, Tesseract conducts various splitting and merging operations into blobs in one word and form a series of character outlines to be recognized [20]. On the first pass, Tesseract recognizes the characters outlines with static classifier based on the features library. If the recognition's result is high confidence, the process will be continue to the adaptive classifier as training data. On the second pass, Tesseract tries in recognizes again those words with low confidence from the first pass, in order to omprove the recognition accuracy. The last step, Tesseract chooses only one result with the highest confidence as the output [5] [19].

RESULT AND DISCUSSION
A total 50 sets digital handwritten image and resulting in 323 characters. As the initial, the image contains pixels, fuzzy, and grainy. Preprocessing has been applied for each image including convert into grayscale in defining noise at the characters, basic morphological operations such as erode and dilate for joining disparate elements and finding intensity bumps and holes in the characters. The last step of preprocessing is noise removal, using median filter, unnecessary elements in the image can be omitted. The image preprocessing has been executed using OpenCV library which support in Java programming languages for this research. The comparation several results of OCR between original image and preprocessing presented in Table 1. OCR result with preprocessing shows significantly return nearly correct output compared with original image. Similarity characters (data no. 3) occurred between "t" and "+", in the other results returning into numbers e.g. "Z" to '2', "g" into "9".

Lily Rojabiyati Mursari, Antoni Wibowo The Effectiveness of Image Processing on Digital Handwritten Scripts Recognition with The Implementation of OCR Tesseract
The calculation of accuracy rate of OCR on each image is determined on the number of character extraction results. In 1995, Rice et al. presented The 4 th Annual Test of OCR Accuracy rate [21].
OCR cannot produce a 100% accuracy rate for characters recognition, it depends on the applied technique approach for the OCR [20]. The test has been done and calculated the accuracy using Equals 2. for each image. Table 2 presents the average success of reading each character from handwritten image between original and preprocessing. From a total 50 sets images, an average of 30.03% of the characters on the original image can be extracted using Tesseract 4.x. Using the same OCR engine, an average of 79.26% can be read on the preprocessing image.

CONCLUSION
The research results in demonstrate recognizing characters from the digital handwritten image with preprocessing steps including grayscale, morphological operations and noise removal implemented before sent to OCR engine has improved the OCR performance. Using OCR engine Tesseract 4.x, original image reached the percentage of success to 30.03% in reading characters from the image. This is because Tesseract already applied the static character classifier, linguistic analysis and adaptive classifier in recognizing characters and words [8]. Meanwhile, preprocessing reach the percentage of success to 79.26% and successfully boost the OCR performance. Therefore, further studies need to explore in implementing more advance methods such as normalization, segmentation and skeletonization of preprocessing in order to get higher accuracy in recognizing digital handwritten both for latin and non-latin text.