• No results found

A Fast Horizontal Edge Detection Algorithm

N/A
N/A
Protected

Academic year: 2022

Share "A Fast Horizontal Edge Detection Algorithm"

Copied!
9
0
0

Loading.... (view fulltext now)

Full text

(1)

A Fast Horizontal Edge Detection Algorithm

Abbas M. Al-Ghaili* , Marini Othman, Hairoladenan Kasim, Zainuddin Hassan

Institute of Informatics and Computing in Energy (IICE) Universiti Tenaga Nasional

(UNITEN) 43000 Kajang, Selangor, Malaysia

Institute of Informatics and Computing in Energy (IICE), Universiti Tenaga Nasional (UNITEN) 43000 Kajang, Selangor, Malaysia

College of Computer Science and Information Technology, Universiti Tenaga Nasional (UNITEN) 43000 Kajang, Selangor, Malaysia

College of Computer Science and Information Technology, Universiti Tenaga Nasional (UNITEN) 43000 Kajang, Selangor, Malaysia

Abstract

This paper proposes a new algorithm to detect horizontal edges of objects and regions inside images.

In addition to its simplicity, the results have confirmed that the proposed algorithm is faster than Sobel operator by about 6 - 11 times. To apply this algorithm, an adaptive thresholding method is applied on the input image, then, an enhancement procedure is used to remove noise and unwanted lines from the image. After that, the horizontal edges are detected. The discussed results and samples have confirmed that the proposed algorithm is robust with inclined images and complex background.

Keywords—Image edge detection; systems engineering and theory; object detection; feature extraction

I. INTRODUCTION

Edge detection has become a very important task for many image processing-based applications.

Edges constitute a significant portion of information in images, and thus can be exploited to perform special purposes. Thus, edge detection plays an important role in the system’s accuracy and performance. There are several applications which can derive a benefit from such features. For example, in literature, a lot of researches and papers have been reviewed in which technical methods have exploited the feature of edge detection and extraction process of objects and regions inside images either color or gray-scale images such as; [1-10].

On the one hand, the horizontal edge detection task is a very important in designing many systems that require information extraction from horizontal edges. Hence, there have been many proposed algorithms contributed to enhance edge detection algorithms performance of both vertical and horizontal directions proposed [11, 12].

For example, the horizontal edge detection has been used for different purposes e.g., to extract the tank level IR imaging information by analyzing the horizontal stripes [13, 14], to detect text in video information retrieval and indexing [15, 16], to strengthen edges and help highlight horizontal distribution [17], to remove noise from the binary image [18, 19], and to detect road network [20] and car license plate [21, 22]. Other important edge detection based methods which have been applied can be reviewed in [23-26].

On the other hand, there is a need to enhance edge detection algorithms in terms of computation time. Therefore, this paper proposes a simple Horizontal Edges Detection Algorithm (HEDA) to relate

(2)

to enhancing edge detection performance in terms of computation time and accuracy from horizontal edges side only.

This paper is organized as follows: Section II discusses in detail the proposed HEDA. Section III presents Results and Discussions. Conclusion is provided in Section IV.

II. THE PROPOSED HORIZONTAL EDGE DETECTION ALGORITHM (HEDA) A. Overview

Simply, an image pre-processing is applied first. Then, the image is enhanced. Finally, horizontal edges are extracted. The proposed HEDA flowchart is shown in Fig. 1.

Fig. 1. The flowchart of the proposed HEDA.

B. Image Pre-processing

There are three main steps carried out. The first step is input image loading in its color form. The second step is to convert the color image to a gray scale image. Thirdly, an adaptive thresholding technique [27, 28] will be applied in order to constitute a binarized image. The proposed flowchart of image pre-processing is illustrated in Fig. 2.

Fig. 2. Image pre-processing flowchart.

(3)

1) Color Image Conversion: Once, the color image has been inserted and loaded correctly, an adequate function is re-called in order to convert it to a gray-scale image. This process is applied on the color image shown in Fig. 3 (a) and the output image of this process is shown in Fig. 3 (b).

(a) Color image; the original image resolution is 1100 ×729

(b) Gray image

Fig. 3. Image pre-processing – image conversion.

2) Image binarization using an adaptive thresholding technique: This step consists of two procedures. The first one explains how the adaptive thresholding technique is applied on the gray image. The second one presents briefly how the binarization process is applied on the gray image.

a) Adaptive thresholding technique: In this process, an adaptively localized procedure contains a mask which moves from top-to-bottom and from left-to-right. This moving mask is the main procedural step for the adaptive thresholding technique used in this research paper. At every time the mask moves, the mask changes its pixel-based center. Then, it processes the localized neighbors by applying an 8×8 window. After that, the pixels intensities are averaged in terms of a gray-scale value.

Then, the new averaged value will be replacing the currently processed pixel’s value. This process goes forward and repeats the same procedure until whole pixels have been completely considered.

Finally, the new pixels intensities (i.e., averaged values) will be the new image’s pixels. This process is briefly depicted in Fig. 4.

Fig. 4. The block-diagram of image binarization using adaptive thresholding technique.

b) Binarization procedure: The new value will be tested before it is converted to a binarized value which is ‘0’ OR ‘1’ with regard to the gray scale range defined by these two ranges (0-127) and

(4)

(128-255) which are corresponding to ‘0’ and ‘1’, respectively. This procedure is mathematically defined by this formula:

𝐼𝑚𝑔𝑏𝑛𝑟𝑧𝑑 = {0, 0 ≤ 𝑎𝑣𝑟𝑔𝐿𝑊 < 128 1, 128 ≤ 𝑎𝑣𝑟𝑔𝐿𝑊 ≤ 255 whereas:

𝐼𝑚𝑔𝑏𝑛𝑟𝑧𝑑 represents all new values in the binarized form to constitute the binarized image

𝑎𝑣𝑟𝑔𝐿𝑊 represents the average value for each 8×8 local window; in its gray-scale form.

This process (formula mentioned above) is applied on the gray-scale image shown in Fig. 3 (b) and the output image of this process is shown in Fig. 5.

Fig. 5. Image pre-processing – image binarization.

C. Image Enhancement

Usually, the binarized image contains unwanted thin edges and noise need to be removed. Doing so will contribute to enhance the image in terms of accuracy and computation time whereas image’s details are reduced once the noise removal process is performed. Therefore, to apply this step, the Unwanted Lines Elimination Algorithm (ULEA) is used [29]. HEDA has the ability to process two pixels at once. At each time of processing, ULEA removes noise from both sides of horizontal, vertical, 450 diagonal, and 1350 diagonal lines as shown in Fig. 6 (a), (b), (c) and (d), respectively.

Fig. 6. The proposed masks for ULEA [29]; (a) 0o direction; (b) 90o; (c) 45o diagonal direction; (d) 135o diagonal direction.

D. HEDA

The whole image is checked pixel-by-pixel starting from top-to-bottom and from left-to-right using a 4×2 mask, as shown in Fig. 7.

Fig. 7. The proposed mask for HEDA.

As shown in Fig. 7, variables x and y represent the number of rows and columns, respectively.

Also, the center pixel of the proposed mask is located at point (1,0).

(5)

In order to detect horizontal edges of an object, pixels’ intensities of the center part of the proposed mask is checked first. Then, top and bottom parts are checked. If they have same values, then HEDA changes pixels’ values of the first row of the center part to the opposite color (i. e., background color);

otherwise, it neglects the current position and shifts the mask to the next location. This process is repeated until all pixels are checked. Once the whole image has been completely processed, extracted horizontal edges are shown.

Here, each two pixels are checked at once (e. g., two locations (0, 0) and (0, 1)). Therefore, this processing technique extracts desired edges in a short computation time.

The HEDA pseudo-code is shown in Algorithm 1. Once this pseudo-code is applied on the image shown in Fig. 5, the HEDA output will be shown in Fig. 8.

create a white blank image, named Img(x,y);

// ∑ℎ𝑒𝑖𝑔ℎ𝑡𝑥=0𝑤𝑖𝑑𝑡ℎ𝑦=0 𝑖𝑚𝑔(𝑥, 𝑦) = 𝑤ℎ𝑖𝑡𝑒;

for every pixel in the binarized image center=1; bottom=1; top=1;

If(four center mask values = black)? center=0;

If(two bottom mask values = black)? bottom=0;

If(two top mask values = black)? top=0;

If(!center AND !bottom AND !top)

two centered-row values of Img =white;

End if

Algorithm 1: The HEDA pseudo-code.

Fig. 8. HEDA output.

III. EXPERIMENTAL RESULTS &DISCUSSIONS

In this section, the experimental results are presented and discussed. The obtained results after the HEDA has been applied on numerous images will be compared to Sobel operator in terms of computation time and accuracy. In this evaluation, four datasets different image resolution are used.

The proposed algorithm has been tested on laptop with specifications: Intel Core i3 CPU 2.13GHz, 2 GB of RAM. The program is running under Windows 7 written in C++ language with OpenCV library.

To evaluate the HEDA performance, two types of measurements will be used, as follows:

A. Computation time

In Table 1, the computation times for both HEDA and Sobel are presented with different image resolutions.

Table 1. COMPUTATION TIMES FOR THE PROPOSED AND SOBEL ALGORITHMS

Different Image Resolutions

Computation Time in mS

HEDA vs.

Sobel

Computation Time Range Sobel HEDA

352×288 31.1 5 ≈ 6

578×384 69.2 7.7 ≈ 8.9

640×480 109 10 ≈ 11

(6)

726×544 158 14 ≈ 11.3

As noticeable from Table 1, the HEDA is faster than Sobel operator by about 6 - 11 times. Also, it is clear that the HEDA much outperforms Sobel when high resolution images are used.

B. Accuracy

In this sub-section, horizontal edges are extracted by using HEDA and Sobel. A sample image of the “Digital Image Processing” book’s cover is used to show the results of running Sobel operator and HEDA for horizontal edges detection side, as shown in Fig. 9.

(a) Input image

(b) Sobel operator (time=82 mS)

(7)

(c) The proposed HEDA (time=10 mS)

Fig. 9. Sobel vs. HEDA for horizontal edges detection.

As shown in Fig. 9, the horizontal edges are efficiently extracted and detected. Also, it is clear that the computation time needed to extract horizontal edges using HEDA is less than the computation time of Sobel operator. A further example on which HEDA is applied is shown in Fig. 10. This example confirms that the HEDA is able to work with various image conditions and complex background. Additionally, it is noticeable that HEDA is robust with inclined images.

(a) Original image

(b) HEDA output

Fig. 10. The HEDA process applied on the image of Town Hall of Augsburg.

IV. CONCLUSION

This paper proposed a new and fast algorithm in order to detect horizontal edges. The results discussed in this paper have confirmed that the HEDA is faster than Sobel operator by about 6 - 11 times depending on the input image resolution. Additionally, the HEDA is robust with inclined images and complex background.

Acknowledgment

This research study is funded by UNIIG 2017 with no. (J510050781/2017-B2).

(8)

References

[1] A. Saba, M. R. Tavakol, P. Karimi-Khoozani, and A. Khavasi, "Two-Dimensional Edge Detection by Guided Mode Resonant Metasurface," IEEE Photonics Technology Letters, vol.

30, pp. 853-856, 2018.

[2] O. P. Verma and A. S. Parihar, "An Optimal Fuzzy System for Edge Detection in Color Images Using Bacterial Foraging Algorithm," IEEE Transactions on Fuzzy Systems, vol. 25, pp. 114-127, 2017.

[3] A. Lejeune, J. G. Verly, and M. V. Droogenbroeck, "Probabilistic Framework for the Characterization of Surfaces and Edges in Range Images, with Application to Edge Detection," IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 40, pp.

2209-2222, 2018.

[4] B. Li, G. Thomas, and D. Williams, "Detection of Ice on Power Cables Based on Image Texture Features," IEEE Transactions on Instrumentation and Measurement, vol. 67, pp. 497- 504, 2018.

[5] P. Shui and S. Fan, "SAR Image Edge Detection Robust to Isolated Strong Scatterers Using Anisotropic Morphological Directional Ratio Test," IEEE Access, vol. 6, pp. 37272-37285, 2018.

[6] S. Biswas and R. Hazra, "Robust edge detection based on Modified Moore-Neighbor," Optik, vol. 168, pp. 931-943, 2018.

[7] L. Romani, M. Rossini, and D. Schenone, "Edge detection methods based on RBF interpolation," Journal of Computational and Applied Mathematics, 2018.

[8] E. Sert and D. Avci, "A new edge detection approach via neutrosophy based on maximum norm entropy," Expert Systems with Applications, vol. 115, pp. 499-511, 2019.

[9] S. Yuan, D. Xiang, X. Liu, X. Zhou, and P. Bing, "Edge detection based on computational ghost imaging with structured illuminations," Optics Communications, vol. 410, pp. 350-355, 2018.

[10] E. R. Davies, "Chapter 5 - Edge detection," in Computer Vision (Fifth Edition), E. R. Davies, Ed., ed: Academic Press, 2018, pp. 119-145.

[11] C. Rasche, "Rapid contour detection for image classification," IET Image Processing, vol. 12, pp. 532-538, 2018.

[12] W. Pei, C. Yang, L. Meng, J. Hou, S. Tian, and X. Yin, "Scene Video Text Tracking With Graph Matching," IEEE Access, vol. 6, pp. 19419-19426, 2018.

[13] C. Ding, L. Dong, and W. Xu, "Image gradient histogram's fitting and calculation," The Journal of Engineering, vol. 2018, pp. 45-48, 2018.

[14] X. Li, L. Lin, and X. Shao, "Auto-adaptive edge detection of tank level IR imaging using double-threshold canny operator," in 2010 International Conference on Anti-Counterfeiting, Security and Identification, 2010, pp. 246-248.

[15] W. Kim and C. Kim, "A New Approach for Overlay Text Detection and Extraction From Complex Video Scene," IEEE Transactions on Image Processing, vol. 18, pp. 401-411, 2009.

[16] H. Song, Z. Liu, H. Du, G. Sun, O. L. Meur, and T. Ren, "Depth-Aware Salient Object Detection and Segmentation via Multiscale Discriminative Saliency Fusion and Bootstrap Learning," IEEE Transactions on Image Processing, vol. 26, pp. 4204-4216, 2017.

[17] M. Moradi and S. Mozaffari, "Hybrid approach for Farsi/Arabic text detection and localisation in video frames," IET Image Processing, vol. 7, pp. 154-164, 2013.

[18] H. Hongping and B. Yanping, "A kind of license plate location based on mathematical morphology and edge detection," in Proceedings of 2011 International Conference on Electronic & Mechanical Engineering and Information Technology, 2011, pp. 2291-2294.

[19] H. Zhang, J. Li, M. Wang, and H. Li, "Image edge detection based on fusion of wavelet transform and mathematical morphology," in 2016 11th International Conference on Computer Science & Education (ICCSE), 2016, pp. 981-984.

[20] M. O. Sghaier and R. Lepage, "Road Extraction From Very High Resolution Remote Sensing Optical Images Based on Texture Analysis and Beamlet Transform," IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, vol. 9, pp. 1946-1958, 2016.

(9)

[21] S. Du, M. Ibrahim, M. Shehata, and W. Badawy, "Automatic License Plate Recognition (ALPR): A State-of-the-Art Review," IEEE Transactions on Circuits and Systems for Video Technology, vol. 23, pp. 311-325, 2013.

[22] A. M. Al-Ghaili, S. Mashohor, A. R. Ramli, and A. Ismail, "Car license plate detection method for malaysian plates-styles by using a web camera," Journal of Science &

Technology, vol. 18, pp. 303-319, 2010.

[23] C. Liu, Y. Xiao, and J. Yang, "A Coastline Detection Method in Polarimetric SAR Images Mixing the Region-Based and Edge-Based Active Contour Models," IEEE Transactions on Geoscience and Remote Sensing, vol. 55, pp. 3735-3747, 2017.

[24] Z. Li, G. Zhao, S. Li, H. Sun, R. Tao, X. Huang, et al., "Rotation Feature Extraction for Moving Targets Based on Temporal Differencing and Image Edge Detection," IEEE Geoscience and Remote Sensing Letters, vol. 13, pp. 1512-1516, 2016.

[25] Z. Fu, S. Song, X. Wang, J. Li, and H. Tai, "Imaging the Topology of Grounding Grids Based on Wavelet Edge Detection," IEEE Transactions on Magnetics, vol. 54, pp. 1-8, 2018.

[26] X. Leng, K. Ji, X. Xing, H. Zou, and S. Zhou, "Hybrid bilateral filtering algorithm based on edge detection," IET Image Processing, vol. 10, pp. 809-816, 2016.

[27] D. Bradley and G. Roth, "Adaptive Thresholding using the Integral Image," Journal of Graphics Tools, vol. 12, pp. 13–21, 2007.

[28] F. Shafait, D. Keysers, and T. M. Breuel, "Efficient Implementation of Local Adaptive Thresholding Techniques Using Integral Images," in Document Recognition and Retrieval, USA, 2007.

[29] A. M. Al-Ghaili, S. Mashohor, A. Ismail, and A. R. Ramli, "Efficient Implementation of VEDA for Highlighting Car License Plate Details," in 2009 International Conference on Future Computer and Communication, 2009, pp. 460-464.

References

Related documents

To build a flexible hash function to satify different requirement, we propose construction AIMC that user can change the number of the step operations.. We just give

G95: Providing short text alternatives that provide a brief description of the non-text content using a short text alternative technique listed below AND one of the

In the question concerning food products considered as a risk factor for stomach cancer, the respondents most often correctly indicated canned food with a high salt content (78.1%

Through an extensive reflection seismic investigation, which includes four new land seismic profiles as well as the incor- poration of existing profiles, river lines, and their

Chicken breast pieces and sliced red peppers covered in a creamy tomato and paprika sauce, topped with chorizo

Effects on Dosha - This herb is kapha hara, madakari, grahi (absorbent) and sukra stambhak, swashar, shoolprashmana (pain relieving), balya (strengthening),

On the other hand, when the player’s video queue size was reduced, the streaming via HLS protocol was first to show changes in quality in both lossy and