Journal of Optimization

Volume 2017 (2017), Article ID 9710719, 11 pages

https://doi.org/10.1155/2017/9710719

## Robust Circle Detection Using Harmony Search

Lincoln Agritech Ltd., Lincoln, New Zealand

Correspondence should be addressed to Jaco Fourie

Received 10 January 2017; Accepted 24 May 2017; Published 2 August 2017

Academic Editor: Ferrante Neri

Copyright © 2017 Jaco Fourie. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

Automatic circle detection is an important element of many image processing algorithms. Traditionally the Hough transform has been used to find circular objects in images but more modern approaches that make use of heuristic optimisation techniques have been developed. These are often used in large complex images where the presence of noise or limited computational resources make the Hough transform impractical. Previous research on the use of the Harmony Search (HS) in circle detection showed that HS is an attractive alternative to many of the modern circle detectors based on heuristic optimisers like genetic algorithms and simulated annealing. We propose improvements to this work that enables our algorithm to robustly find multiple circles in larger data sets and still work on realistic images that are heavily corrupted by noisy edges.

#### 1. Introduction

Circle detection is a key element in the larger field of automatic extraction and identification of geometric shapes from digital images. The ability to identify and extract shapes from images has many applications in industry and agriculture. This is because simple geometric shapes are common in man-made environments and are often used in symbols that only have meaning when properly identified.

Circle and ellipse are particularly common shapes to identify due to their application in biological cell tracking, automated mechanical parts inspection, and biometrics (iris detection). Circle detection is traditionally done using the circle Hough transform (CHT) [1, 2]. The CHT algorithm has been used for circle detection for over 30 years and much research has been done to improve the original algorithm. Most of the research focused on the main limitations of CHT, namely, high computational and storage requirements. Proposed improvements include probabilistic, randomised, and fuzzy adaptations of the original algorithm [3–5]. These improvements all aim to decrease the computational complexity of CHT and some also address the accuracy of the algorithm in the presence of noise [6].

With the dramatic increase in computational power, more researchers have begun investigating metaheuristic optimisation algorithms as possible approaches to more robust and accurate circle detection. These algorithms are often biologically inspired like the genetic algorithm and the particle swarm optimisation algorithm. They are usually computationally expensive but have the advantage of not making any assumptions about the objective function or the amount and type of noise that may be present. This usually implies more robust and accurate performance on noisy or ambiguous data.

Both genetic algorithms and particle swarm optimisation algorithms have been successfully used in circle detection along with other metaheuristics like simulated annealing and bacterial foraging optimisation algorithm [7–10]. We propose the use of another biologically inspired metaheuristic optimiser, namely, the Harmony Search (HS) algorithm [11].

Harmony Search is a musical improvisation-inspired metaheuristic optimisation method originally developed for the design of pipeline network systems and published in 2001 [12]. Since its publication, it has been used in many engineering and scientific fields, including computer science, as a robust optimisation technique [13].

#### 2. Theory

In this section, we introduce circle detection in digital images and give an overview of the circle Hough transform (CHT). Being the most popular method of circle detection, the CHT gives us a starting point to investigate circle detection methods with specific focus on their limitations and accuracy under challenging conditions.

We pay specific attention to circle detection methods that interpret the problem as a fitness function that has to be optimised and that make use of metaheuristics to solve the optimisation problem. We then introduce Harmony Search (HS) as a heuristic optimiser and mention some of the variants of the original algorithm that attempt to address the limitations of traditional HS.

##### 2.1. Classical Hough Transform Based Circle Detection

As previously mentioned, the classical way to do circle detection is using the circular Hough transform. This method assumes that the edge pixels of the image have already been identified using one of the many edge detection methods, for example, the Canny edge detector [14]. The collection of edge pixels, called the edge map, is then processed to identify which of the pixels is part of a circle by transforming the edge pixels into a 3D parameter matrix called the Hough parameter space. The maximum point in the parameter space corresponds to the parameters of a circle that has the most edge pixels on its perimeter.

Consider a circle in 2D space represented by the equationwhere represents the centre of the circle and is the radius. From this equation, we can map each pixel () to a conic surface in the 3D parameters space () that represents all possible circles that the pixel can form a part of. By discretising and limiting the parameter space based on the original image dimensions, a 3D accumulator matrix is formed. The location of the maxima in this matrix represents the circles detected by the CHT.

Though this simple approach is somewhat robust to noise and occlusion, the main limitation is in the computational and space requirements. As the 3D accumulator matrix grows cubically with the size of the image, the memory required to store this matrix and the time spent creating it quickly become prohibitive. This is especially true when circle location accuracy demands that the parameter space be quantised into accumulator cells that are as small as possible or when the space needs to be enlarged to beyond the size of the image to allow for partial circle detection that may have centres that fall outside the image bounds. In Figure 1, we show a common result of the CHT applied to a noisy image. In this example, we did not apply a set threshold to determine which maxima in the accumulator should be selected as valid circles but instead picked the top 5 largest values. In this way, we highlight the false circles that are often detected in real image examples. We label the strongest circle in the accumulator as and the second strongest as to show that simply picking the strongest circles in the accumulator will not solve the false circle problem even when the exact number of circles to be detected is previously known. If we only picked the strongest two circles in this example, the large circle on the left would not be detected while the small circle in the middle is chosen instead.