Automatic Data Capturing System for Seven Segment LED Display
Ong Chai Teng, A.R. Syafeeza*, Norihan Abdul Hamid, K. Syazana-Itqan, Y.C. Wong, P. Marzuki
Affiliation
Faculty of Electronics and Computer Engineering, University Teknikal Malaysia, Melaka
Corresponding Author
A.R. Syafeeza, Faculty of Electronics and Computer Engineering, University Teknikal Malaysia, Melaka; E-mail: syafeeza@utem.edu.my
Citation
Syafeeza, A.R., et al. Automatic Data Capturing System for Seven Segment LED Display. (2019) J Bioinfo Proteom Img Anal 4(1): 8-13.
Copy rights
© 2019 Syafeeza, A.R. This is an Open access article distributed under the terms of Creative Commons Attribution 4.0 International License.
Keywords
Data capturing system; Image pre-processing; Image analysis; Image recognition; MATLAB
Abstract
Automatic data capturing system provides an alternative and effective way of data collection instead of manual data collection in the laboratory, especially for experiments that need to be carried out for a long period of time. It is able to solve common mistakes made by humans, like misreading or mistyping data. Thus, a new smart data recognition system for a seven segment LED display is developed to sort the whole process of data collection to become more systematic and accurate. An image is captured and saved automatically in an image file, and then it is processed through MATLAB software to identify the digits displayed on the LED display. Once the image is pre-processed, analyzed, and recognized, the final output values obtained are transferred to an existing Excel file for further process according to the user’s requirement. From the results obtained, it was proven that binary thresholding is the best pre-processing method and the brightness of the image should be set to ‘0’ for better recognition output.
Introduction
Data are items that provide an association between humans and the world we study. As a consequence, data hold an important role in all applications of the scientific method and also progress in science, business, and industry. Hence, the quality and accuracy of data has always been a significant target of a venture. Automatic data capture is a modern method used to obtain graphical data and transform it into an efficient and editable digital format. It detects objects, then collects data and enters it directly into the computer system for further usage, and the whole process does not involve humans. As can be noticed, most of the major losses in operations are affected by the accuracy of data and information. This is primarily due to common mistakes made by humans in the data collecting and recording process. Technicians handling hundreds of tubes, loading samples, and labelling samples can and do make mistakes.
With the development of an automatic data capturing system, it is able to eliminate wasted space and saves time for collecting, keeping, and filing. Besides, it also helps reduce the expenses on storage rentals and cost of manpower.
There are many types of automatic data capture where typical technologies are considered. One of it is the Optical Character Recognition (OCR). OCR is an electronic conversion technique that is used to convert text on an image into machine encoded text. By 1950, electronic data processing had become an important field as the technological revolution was moving forward at a high speed. Data entry was performed through different effective and efficient ways as the amount of data needed had increased. At the same time, technology for machine reading was becoming sufficiently mature for application[1]. The early version of the OCR machine had to be trained with images of each character, and worked on only one font at a time. But now, the system is more advanced in producing a high degree of recognition accuracy for most fonts.
The data capture system first obtains external data through the capture of an image. Then the image needs to undergo some processes before the data can be recognized by OCR. The processes involved are image preprocessing and image analysis where all these processes will be run using the MATLAB software with the algorithm implemented.
Literature Review
Digital image processing is a new development which started in the sixties when third generation computers made their appearance. A large quantity of information can be found in an image. Therefore, due to the ability of a computer to process high capacity storage and calculation speeds, it could be used in developing algorithms for processing large numbers of applications. One of the first fields to use digital processing to enhance images is space research in 1964 at the Jet Propulsion Laboratory in Pasadena, California. It was used to correct camera distortion in the images of the lunar surface to be transmitted back to Earth from the Ranger 7 probes by a computer. After that, many techniques for image enhancement and restoration started to develop in connection with the Surveyor, Mariner and Apollo missions.
There are practical applications that have been implemented, ranging from medical diagnostics to visual recognition by computer robotics and artificial intelligence fields. It also includes automatic recognition of text of handwriting and license plates[2], and shapes of objects by a machine to replace the use of the human eye[3]. With the rapid development of information technology, digital technology and microelectronic technology for digital image processing are becoming more and more advanced in terms of the new methods developed. It gathers an image information acquisition, transmission, storage, transformation, and understanding the content like in reality and the disciplinary system in order to form the richest in the professional field where digital image processing is divided into three levels which include image pre-processing, image analysis and image understanding[1].
Image pre-processing is the operation that is used to improve an image’s data from the lowest level of abstraction or enhances some image features which is important for further processing. At the same time, it will not increase the information content in an image[4]. For image analysis, the steps involved are image segmentation, feature extraction, and classification, which are the processes used to extract useful information from an image. Image segmentation divides an image into multiple segments so that the image is then easier for further analyzing.
The most general software used by engineers and scientists in both industry and academia is MATLAB where it is used to perform numerical computations, develop and test mathematical algorithms and process images with related usage. The data is also displayed in a wide range of different development work. Its image processing application is the greatest; therefore MATLAB offers a lot of different image modifications[5]. One of the common image pre-processing applications that is developed using MATLAB is the car license plate extraction system. One of it is written by P.V. Suryanarayana. The image pre-processing algorithm used in this paper is the Morphology based technique. It operates in the pre-processed, the edge image of the vehicles. The edge image is generated by performing the Sobel edge detection operation on a grayscale image. Characteristic features such as license plate width and height, character height and spacing are considered in defining structural elements for the Morphological operations. Connected component analysis is used to select the band containing the license plate from the selected segment. Besides, the research also shows the dependency of the structuring element on the accuracy of the system[6]. C. Nelson Kennedy Babu also proposed an application regarding license plate localization using the Morphology technique. It is based on the combination of Morphological operation that sensitive to specific shapes in the input image with a good threshold value by which the license plate is located. To detect the vertical edges in the input image, the technique used is the edge features for the license plates and characters. The resultant binary image is produced by counting the number of ON pixels in each row of the image array. The row which contains the highest values is treated as the license plate region. Morphological operations such as dilation and erosion are then processed to remove the unwanted regions and enhance the wanted region. The enhanced region is then extracted[7].
In the study of various image segmentation algorithms for different types of images by Krishna Kant Singh, some specific segmentation algorithms were analyzed with the consideration of the type of input images like the color image, grayscale image and a text image. Besides, some segmentation algorithms used for text detection based on difference and similarity features were also discussed. All the algorithms have their own strengths and weaknesses. Some cannot be used on samples having similar backgrounds and foregrounds, while the others cannot be used due to instability. Lastly, the study concludes that, based on the input image, the algorithm should be chosen to get the best final output result[8]. Besides that, there is a regularly used method which is the Otsu’s method. It selects the threshold value by maximizing the between-class variance. A paper written by Kumar, Pant, and Ray discusses the embedded Differential Evolution (DE) using Otsu’s method to select an optimized threshold value[9]. This method is then tested on a set of images, and the results showed the effectiveness of the proposed technique. In addition, another paper written by Gautam and Ahmed was on the fuzzy based edge detection using Successive Otsu’s method. In this paper, the algorithm of this method is described and utilized in a grouping image histogram into different partitions. The algorithm developed is used to provide the threshold parameter to the classical Sobel Operation in order to enhance its edge detection capability using fuzzy logic[10]. The final results are then compared with the Canny Edge Detector.
Table 1: Comparison of different image processing methods.
Title |
Method |
Strength |
Weakness |
Efficient Fuzzy Edge Detection Using Successive Otsu’s Method[10] |
Successive Otsu’s Method |
-Able to enhance the performance of Classical Sobel Edge Detector up to the level of standard Canny Edge Detector. |
- |
Using Morphological Operations-Erosion Based Algorithm for Edge Detection[11] |
Morphological |
-Accurate positioning -Computation time which is suitable to be used in real-time -Able to produce one-pixel-width continuous edges |
-Complexity of the algorithm -More steps involved |
Image Segmentation Based on Multiple Means Using Class Division Method[12] |
Class Division Method |
-Better identifies fine structures of objects in complex images -Low computational cost -Reduce computational time |
- |
A Novel Design For Vehicle License Plate Detection and Recognition[13] |
Hough Transform |
-Reduce computational time |
- |
Methodology
In order to obtain data from the LED display, a simple seven segment LED display circuit is constructed where the circuit is a 4-digit up counter. Then, the circuit is combined with a webcam for capturing purposes. To ensure the whole system automatic, the webcam is set to capture automatically. The image captured is then saved into a folder on the computer.
After obtaining the external data through the captured image, the image saved is used for image processing to recognize the digit numbers using the algorithm implemented in MATLAB. The flow of the process is as shown in Figure 1.
Figure 1: Block diagram of an image processing.
The technique used for pre-processing in this paper is simple thresholding. From a grayscale image, thresholding can be used to create a binary image. Therefore, the image is converted into grayscale. The size of the image is then determined by determining the rows and columns. After that, a zero image is created by the rows and columns array from the grey scale image. Then only the thresholding is performed on the image with the MATLAB code as shown below:
for i=1:r
for j=1:c
if I(i,j)>105
im(i,j)=1;
end
end
end
After the image is converted to binary, all small objects are removed from it using the command bwareaopen.
Once the pre-processing of the image is completed, the following step is image analysis. The steps involved are image segmentation and cropping which is the process of extracting meaningful information from an image. Segmentation subdivides an image into its constituent regions or objects. The level to which the subdivision is carried depends on the problem being solved. That is, segmentation should stop when the objects of interest in an application have been isolated.
The number segmentation is done using blob analysis, which involves the command bwlabel. This command labels and gives the number of pixels connected together in a sequence to form a group of connected objects. Then, the line matrix function is applied to the algorithm that takes the binary image. A row in the image with no object which is only black pixels is then looked at and the image is split along this line. All of the empty areas around the objects are cropped in another sub-function called clip. To recognize the seven segment digit numbers in the image, a template matching is applied in this part. A template is created at the beginning of this step using all the sample images of each digit after isolation which is cropped into a .bmp file with a constant size of 50 x70 using mat 2cell. There is a requirement of a single array containing all digit numbers so that all the numbers may be compared using a single loop. Otherwise, long coding would be required for correlation. By using a multi-dimensional array, the binary information is saved. This is done using the mat 2cell function where the multi-dimensional matrix is converted to a cell with the same information stored. Then, a function named read letter is created in order to compare the input digit and the template with the uses of the correlation function. A for loop is generated in the algorithm, starting with the first loop and incremented by 1 for each successive loop until the last digit in the image is reached. After that, the 2D correlation coefficient of the matrix of the input image is computed with the matrix in the template using the function corr2. The correlation coefficient is appended to the array using horizontal concatenation and then comparison is done with the template to find out the matched digit. Finally, after the seven segment digit numbers are successfully recognized using the MATLAB algorithm, data is transferred and saved in an existing Excel file for further usage using xls write. At first, the Excel file is read by the MATLAB by using xls read to identify what is the currently available row in column A to insert the data. This is so that any old data is not updated whenever new data is inserted.
Results
In the hardware result, at the first stage, the up-counter circuit is constructed on the breadboard without the 555 timer but only with the IC4026. So, the problem encountered was that the circuit does not have any increment shown in the 7-segment display, where only digit 0 is displayed. After adding in the 555 timer, the problem is solved. The 7-segment display shows an increment of plus one whenever the push button is pressed. Then, the circuit is simulated in Proteus ISIS before coming out with the PCB design in ARES to make sure the circuit works. Since the 7-segment display must be arranged in series in order to capture and recognize, the problem of copper route overlapping was faced during the design in ARES. To solve this problem, jumper wires were used in the circuit design. Some of the copper routes are linked manually instead of auto routing and connected by jumper wires.
After the circuit is fabricated, the 7-segment display did not function. After troubleshooting on the fabricated circuit, the problem was due to no connection of VCC and GND at the IC4026. As during the simulation in ISIS, the IC4026 in the component list was not provided the pin of VCC and GND. So, after converting it to the ARES design, no copper route is assigned by the system to connect to the power source and ground. The missing connection caused the rest of the three seven segment display to not light up when powered. After making the connection using jumper wire, the problem was solved and the rest of three seven segment displays were lighted up.
Figure 2: The final output of the hardware result.
In the software result, different algorithms and methods were used to test the image processing. Finally, thresholding is chosen as it produced the best binary image. Three methods were tested which included Otsu’s, Morphological, and thresholding. For Otsu’s method, the graythresh command is used. While for the Morphological method, it is more complicated and more steps were involved where it at first needed a setup of a structural element for the process to carry out. Then, the step was followed by dilation and erosion. Figure 3 shows the difference of the final output binary image of each method. As for Otsu’s method in Figure 3(a), the result is quite same as the Morphological method but there is an extra white region in the binary image. For the Morphological method in Figure 3(b), although the numbers shown are clearer than Otsu’s method and there is no extra white region, the background is fully black, but as the holes of the number are filled, it may cause a recognition problem for number 0 and 8 As after the imfill command is used, both numbers 0 and 8 are the same. So, recognition fails.
But for thresholding in Figure 3(c), the holes of the number are not filled up and the objects and background are clearly shown. So, every number can be differentiated and recognized very well. Thus, the accuracy is much higher compared to the other two methods. Thus, this method of image pre-processing is used.
Figure 3: The output of binary image using a different method.
The result of image processing is also affected by the brightness of the webcam. So, the brightness was adjusted until the best image processing result was produced. Finally, brightness was set to 0. With the brightness set to 0, the best binary image is produced with no extra unwanted objects. If the brightness of the image is set too high, the final result received is inaccurate and the digit number read may be different from what is shown in the input image. Figure 3.3 shows an example of a failed image processing and recognition when the brightness of the image is set to 50. There are still many unwanted objects after image pre-processing, causing the final recognition to go wrong. Although the input image had only shown 4 digits, the final recognition as shown in Figure 4(a) shows that the system had recognized 8 digits instead of Figure 4(b) digits. This is because 8 objects were detected in the image segmentation and cropping part in Figure 4(c, d).
Figure 4: Sample of failure recognition with brightness 50.
A GUI was designed and created in MATLAB as shown in Figure 5. There are 3 push buttons in the GUI. The first button is to load an image from the image stored file and the second button is to convert the original image to binary image. The final button is to get the recognized data to be shown in an output message outbox. At the same time, the recognized data is exported to an existing Excel file and saved. The axes box created is used to display the image.
Figure 5: The layout of the GUI.
Table 2 shows the method of image pre-processing which can produce the highest accuracy, known as the binary thresholding method. Three out of three images were recognized correctly. Thus, this shows that the binary thresholding method is the most suitable method to use for the pre-processing of 7 segments LED display images.
Table 2: Data analysing process using different image pre-processing method
Method |
Digit (input image) |
Digit (recognized output) |
Accuracy (%) |
Otsu’s |
2319 |
112315 |
33.33 |
5139 |
115139 |
||
4179 |
4179 |
||
Morphological |
2319 |
2319 |
83.33 |
5139 |
5135 |
||
4179 |
4175 |
||
Thresholding |
2319 |
2319 |
99.99 |
5139 |
5139 |
||
4179 |
4179 |
As Table 3 shows, the correct output result will only be obtained when the brightness is set equal to 0, while the other brightness levels produced wrong results. This shows that the lower the image brightness, the more accurate the output result.
Table 3: The comparison of the result with different image brightness.
Digit (input image) |
Image brightness |
Digit (recognized output) |
5139 |
100 |
1151135 |
50 |
51139 |
|
0 |
5139 |
|
6249 |
100 |
182149 |
50 |
81245 |
|
0 |
6249 |
|
7549 |
100 |
171549 |
50 |
75148 |
|
0 |
7549 |
Conclusion
In conclusion, this project has been successfully developed according to the objectives listed. A simple up counter hardware circuit was built to show the 7 segment LED display with the webcam for automatic capturing purposes. The entire algorithm in MATLAB can be integrated into the system and a GUI was also designed. The digits shown in the form of 7 segments was able to be recognized by the system correctly and transferred to an existing Excel file. The system can operate as expected but with some limitations for future development and enhancement. Ultimately, the best pre-processing method is binary thresholding and the image brightness should be set to ‘0’ for better recognized outputs.
Acknowledgment
Authors would like to thank Universiti Teknikal Malaysia Melaka (UTeM) and Ministry of Education Malaysia for supporting this research under PJP/2018/FKEKK (9D)/S01622.
References
- 1. Eikvil, V. Optical character recognition. (1993).
Pubmed | Crossref | Others
- 2. Radzi, S.A., Khalil-Hani, M. Character recognition of license plate number using convolutional neural network. (2011) int Visual Informatics: Sustaining Research and Innovations 7066: 45–55.
Pubmed | Crossref | Others
- 3. Gonzalez, R.C., Woods, R.E. Digital Image Processing (3rd Edition). (2009).
Pubmed | Crossref | Others
- 4. Grover, N. Image Processing using MATLAB. (2015) Int J Res 2(5): 160–161.
Pubmed | Crossref | Others
- 5. Sandeep Tiwari, P.K.Y., Shivangi, M., Priyank, B. Optical Character Recognition using MATLAB. (2013) Int J Adv Res Electron Commun Eng 2(5): 579-582.
Pubmed | Crossref | Others
- 6. Suryanarayana, P.V., Mitra, S.K., Banerjee, A., et al. A Morphology Based Approach for Car License Plate Extraction. (2005) Int Conf IEEE India Counc 24-27
- 7. Babu, C.N.K., Nallaperumal, K. A license plate localization using morphology and recognition. (2008) Control Commun Autom 1: 34–39.
- 8. Singh, K.K., Singh, A. A study of image segmentation algorithms for different types of images. (2010) Int J Comp Sci 7(5): 414–417.
Pubmed | Crossref | Others
- 9. Kumar, S., Pant, M., Ray, A. Differential evolution embedded Otsu’s method for optimized image thresholding. (2011) World Congr Inf Commun Technol 325–329.
- 10. Gautam, D., Ahmed, M. Efficient Fuzzy edge detection using Successive Otsu’s Method. (2014) 1–5.
- 11. Alazawee, W.S., Abdel-Qader, I., Abdel-Qader, J. Using morphological operations - Erosion based algorithm for edge detection. (2015) Int Conf Electro Inf Technol 521–525.
- 12. Jayasree, M., Narayanan, N.K. Image segmentation based on multiple means using class division method. (2015) Int Conf Ind Instrum Control 1264-1267.
- 13. Prabhakar, P., Anupama, P. A. Novel Design For Vehicle License Plate Detection and Recognition. (2014) Int Conf on Current Trends in Eng Tech 7–12.