Image Edge Detection Based on Aco-pso Algorithm

—This survey focuses on the problem of parameters selection in image edge detection by ant colony optimization (ACO) algorithm. By introducing particle swarm optimization (PSO) algorithm to optimize parameters in ACO algorithm, the fitness function based on connectivity of image edge is proposed to evaluate the quality of parameters in ACO algorithm. And the ACO-PSO algorithm is applied to image edge detection. The simulation results show that the parameters have been optimized and the proposed ACO-PSO algorithm presents better edges than traditional methods.


INTRODUCTION ACO (Ant Colony Optimization
) is an intelligence algorithm proposed by Marco Dorigo [1][2] in his doctoral thesis.ACO simulates the foraging behavior of ant colony in the nature.The distributed, paralleled mechanism with positive feedback leads ants to select the shortest path.With its robustness [3][4], ACO has been successfully applied to image edge detection [5][6][7].In 2004, X. Zhuang proposed a machine vision model based on the ant colony system, which is effective in edge feature extraction [5].H. Nezamabadi-pour improved the parameters selection ranges of ant colony search algorithm in image edge detection through large numbers of experiments [6].In paper [7], heuristic information is improved, and fuzzy C-means algorithm is introduced for image preprocessing and extracting the pheromone threshold, which reduces time consuming.But these improved ACO have obvious shortcomings, i.e. the parameters are selected by experience manually, which needs large numbers of experiments.The parameters have to be reset for different images.So the algorithm does not have universal applicability.And improper parameters will cause the premature convergence in ant colony algorithm.So, parameter optimization becomes a research point when using ACO algorithm.K. Vaisakh [8] proposed a method to optimize ACO parameters by GA (Genetic Algorithm), which avoided the drawbacks of artificial setting parameters.But GA is complicated and has large time and space complexity.However, PSO is easy to implement, with fast convergence and use a few parameters [9] .PSO (Particle Swarm Optimization) simulates foraging behavior of birds and don't need to do a variation, which makes it superior to GA in parameter optimization.So, PSO is applied to optimize the parameters of ACO [10][11][12][13][14] .In paper [10], ,,    , three parameters of ACO are optimized by PSO, so that parameter values have continuity, random and accuracy.B. Shuang [11] proposed a PS-ACO algorithm to solve TSP (Traveling Salesman Problem), and its convergence performance is better than GA and ACO algorithm.ZHANG Chao [12] proposed an ACO algorithm based on parameters optimization by PSO, a pheromone update method of global asynchronous combined with elite strategy is applied, which reduces iterations and has a fast rate in dealing with robot path planning problem.Authors in [13][14] made a discretization to the range of inertia weight of PSO, the inertia weight become self-adapted, which enhances the optimization performance.
PSO algorithm has been used to optimize parameters of ACO in TSP and path planning problem, but it has not been researched in image edge detection.In this study, we aim on the parameters optimization problem in ACO algorithm.And the ACO-PSO algorithm for image edge detection is proposed.The coming issue is the design of fitness function in PSO.The performance of fitness function will determine the effects of ACO parameters optimization and the results of edge detection.Therefore, we take the image edge quality as parameter assessment criteria in fitness function of PSO.This involves the study of edge quality evaluation methods.Fine image boundary should have well accuracy and continuity, but recently there is no one universal method to evaluate the quality of edge image [15] .Generally, methods are divided into two types, direct evaluation method and the numerical evaluation method [15] .Visual evaluation method means estimate by human vision, of which the evaluators' experience, image type, or personal like matters.It cannot be objective [5-6]  or applied to the intelligent image processing system.Numerical evaluation method is based on ground truth.The standard boundary is drawn by hand or a certain edge detection algorithm.The differences between the detected images are taken as the evaluation index.But this method is complicated and inefficient.Boundary extracted by canny operator is used as the ground truth in paper [16].Or benchmarks were generated by traditional detectors [17] .
In response to these shortcomings, this paper proposes a method without ground truth, evaluate the quality of image edge, and represent the quality by image edge quality evaluation function.By analyzing the connected component of pixels, the fitness function of PSO is designed to evaluate the quality of edge image and the parameters of ACO are selfadapted to find the balance between parameter selection and the effect of edge detection.Experiment shows that, the proposed method has the characteristics of real-time and high efficiency and is suitable for image edge detection of ACO-PSO algorithm.
The organization of the paper is as follows.Sect.II demonstrates the basic theory of ACO algorithm.Section III provides details about the proposed methodology of edge detection based on ACO-PSO.Experimental results are discussed in Sect.IV and V gives the conclusions of this paper.

II. EDGE DETECTION BASED ON ACO ALGORITHM
For an image of size MN  , MN  ants are distributed in the image randomly and search edge location according to the variance of grayscale and the pheromone distribution.
This study selects the maximum gray level gradient in eight neighbors of four directions as the pixel gradient: where , ij I is the gray value of pixel ( , ) ij ; max I is the biggest gray value of image.
Ant colony select the location of the next randomly with probability, the transition probability of ants in pixel ( , ) where After all the ants move from the k th step to the 1 k  th step, update the pheromone given by: , ,, ( ). , is the pheromone released by all the passing ants thought ( , ) ij in k th step.Where , , , = / ,if ant pass through (i,j) () 0, .
When ants go through all the steps, which meet the termination condition, finish one time of searching for image edge.Although there are many parameters of ACO, but three main parameters have larger impact on the algorithm performance: the pheromone impact factor  , the heuristic function factor  , the pheromone volatilization coefficient  .The selection and optimization of parameters are crucial to the performance of ACO algorithm [18-20] .In addition, extracting the edge is the primary purpose of the algorithm, while keep the randomicity of search and convergence of algorithm.
To get the edge image, threshold segmentation is made to the pheromone matrix, removing the background information and guaranteeing the integrity of the edge information.The method of setting threshold manually is inefficient and not suitable for massive calculation through repeated experiments and observing results [5] .Our method is by iteration, calculates the threshold by statistics histogram of grayscale, which produces satisfactory image edges.

A. Parameters update by PSO
To optimize these three parameters simultaneously, an array ,,    is set for optimization.Randomly generate an array as the position 1 2 3 ( , , ) x x x x of a particle, and the speed of the particle in the solution space is Particles updated speed and location as follows: Where  is inertia weight, control the influence of its inertia to the evolution of particle.p is the global optimal position of all particles.

B. Edge quality evaluation
In this paper, the edge quality is taken as the parameters optimization standard of the fitness function in PSO.And it is represented by the edge quality evaluation function.Traditional ways often lose important boundary and the image is intermittent [21] .Its connectivity is worse than the detected edge by ACO algorithm.Analyze the connected component of image pixels, and calculating the ratio between eight connected components and four connected components, which reflects the line connectivity of boundary.This connectivity reflects the error detection and missed in image edge detection, can evaluate the edge quality properly [22-24] .This method was described and proved in detail in paper [25].The smaller the value of C/B, the better the linear connection degree is.This method is easy to implement, but high connected component does not mean enough edge points been detected.For binary edge images, edge point is the pixel where the pixel value is 1, which is an important indicator of the linear connection degree.From the viewpoint of information extraction, edge detection aim to extract more effective edge point information while maintaining the linear connection.More edge points detected, the better the edge quality of edge detection.In this paper we proposed a method improved of [25], the connected component and the edge points are combined to obtain rich edge information.The improved edge quality evaluation function (Adpf), i.e. the fitness function is calculated as follow: If the value of the evaluation function is smaller, which means the eight connected components become smaller, while four connected components and edge points are relatively more, keep enough edge points information.Then the better image edge connectivity is, and better the edges extracted.Simulation experiments show that this method is feasible and consistent with the visual observation.
In order to illustrate the effect of edge evaluation function, different standard images were detected by five operator methods.The comparison of detect effects by method of [25] and the proposed evaluation function (Adpf) is shown in TABLE I.As mentioned above, the smaller the value of edge evaluation function, the better the effect of image edge detection.Both two rows of data in TABLE I. are going down from left to right in each image, which means, in traditional operator methods, the detection effect of Roberts operator is the worst, while the Canny operator is optimal.Suggesting the results of the proposed edge evaluation method and method of [25] are consistent with visual method, which is suitable for evaluate the effect of image edge detection.

C. Image edge detection based on ACO-PSO algorithm
Due to the equal probability of selecting noise and edge points, traditional ACO is not anti-noise.In order to suppress the noise, median filter is adopt in preprocessing, which eliminate the random noise effectively.After each update, the particle swarm obtains a set of better parameters, which is sent to ACO for edge detection.Then fitness value is calculated to present the quality of the detected edge.Particles move to better directions based on the value, and update the location of next generation.New location parameters are used by ACO for detection, until reaches the iteration time.Then output the parameters of optimal location and the edge image.To improve efficiency and reduce iterations, this study only updates local pheromone for detection.The proposed image edge detection of ACO-PSO algorithm includes following steps: 1) Input image.Image Median filtering, and pretreatment with formula (1).
2) Initialization of particle swarm matrix: set ranges of particle swarm parameters; randomly select a group of particles. 3

) Calculate the value of edge quality evaluation function in PSO, i.e. Adpf:
For k = 1 to particle SwarmSize Image edge detection: For m = 1 to ant StepNum
End For

5) Output the optimal parameters and edge image.
Massive experiment results show that, the number of ants is proportional to the square root of the number of image pixels, without considering the complex degree of image.The complexity of ACO-PSO algorithm for edge detection rely on the particle swarm iterations, swarm size, step number of ants, ants quantity, the image size and its complexity of edge.The larger the image and more complex the edges, the more number of ants used searching for edge points, and higher complexity of algorithm.But there is still no unified standard for edge complexity or image complexity.As for different images, the number of each grayscale, the spatial distribution of pixels and target are extreme variation and hard to describe

A. Edge quality evaluation function
Lena 、House、Cameraman 、Peppers were detected by ACO-PSO algorithm with method of [25] and the proposed evaluation method (Adpf).The simulation results are shown in Fig. 1.It can be seen that the improved evaluation method detected more edge points, and obtain rich edge information.For example, the showcase behind Lena, the shadow under the eaves of House, Cameraman's leg and ground, the outline of three peppers in the middle of Peppers in Fig. 1 (c).While all these details are get lost in Fig. 1 (b).So, the improved edge quality evaluation function is superior to the method of [25], which obtains high quality of image edge.www.ijacsa.thesai.org

C. Contraction of image edge detection
The ACO-PSO algorithm uses particle swarm to search the optimal parameters automatically, which save plenty of time.In this study, we set parameters manually and test different standard images to prove the effective of ACO-PSO algorithm on parameters selection.For example, as to Lena image, set =1.1, 7.5, 0.8

   
, which is a set of parameters around the optimal ones according to result of edge detection by ACO-PSO algorithm.Standard test images, Cameraman, House, Peppers are simulated, using Canny operator method, the FCM cluster ACO algorithm proposed in [7] and the manual setting parameters method, and the algorithm in this paper respectively for edge detection.The simulation results are shown in Fig. 4. As we can see, Canny operator method obtains fewer details.Manual set parameters method and the FCM cluster ACO algorithm is easy to lose details, both produce less connectivity than ACO-PSO algorithm.So the proposed ACO-PSO algorithm has universal applicability and detects better image edges.www.ijacsa.thesai.orgThe comparisons of these methods from images have shown above.In addition, TABLE Ⅱ .presents their Adpf values.As can be seen from the data, Adpf value of edge detected by Canny operator is large.It means poor edge continuity.ACO algorithm manually set parameters are not the best.ACO algorithm can suppress noise and eliminate the impact of noise.FCM cluster ACO algorithm detects worse edge continuity than the ACO-PSO algorithm.And the Adpf values of ACO-PSO algorithm for edge detection are small, with noise or not, are better than manual set parameters method and Canny operator.It illustrates that ACO-PSO algorithm is effective to optimize parameters adaptively, and maintain the edge detection quality during noise reduction.

V. CONCLUSIONS
In this paper, image edge quality evaluation method is applied to fitness function of PSO, parameters of ACO are optimized by PSO automatically, and ACO-PSO algorithm was applied for image edge detection, solving the problem of parameters selection.Different kinds of improved ACO can be transplanted to the proposed algorithm, which will save plenty of time and energy in parameter selections.Experiments show that, the improved ACO-PSO algorithm can obtain better edge connectivity and higher detection precision than traditional ACO methods, which shows better anti-noise performance and universal applicability.The design of edge evaluation function has important influence on the edge quality.Further direction of our study will be the image edge quality evaluation.
k allowed is the allowed pixel for the next step.

For
AND ANALYSIS In this study, runtime environment: Windows 7 32-bit OS, MATLAB 8.1, Intel Core i5 2.30 GHz CPU, 2.00 GB RAM.Lena standard drawing was chosen as research object, the image size is 256*256.The ACO-PSO algorithm parameter settings are as follows: ranges of ,,    are [0.1 2.5],[4.5 8.5],[01] ; others: ant colony step is 300, memory length is 40; particle swarm size is 3, the coefficients 1 2 1.2 cc  , coefficient of inertia weights is reduced from 0.5 to 0.3 by linear gradient.

Fig. 1 .
Fig. 1.Effects comparison of evaluation functions.(a) the original image; (b) image detection before improved; (c) image detection after improved B. Algorithm performance Preset the PSO iterations to 20, run the ACO-PSO algorithm 4 times, the evaluation function values of different images are shown in Fig.2.The vertical axis represents the minimum Adpf value of the edge image during iteration.15 iterations later, the global optimal solution was obtained, the algorithm was convergent, and the quality of edge image came to a steady level.For example, the Adpf values of Lena edges are below 0.130, which is lower than 0.241, the Adpf value of Canny operator (in TABLE I).Likewise, the Adpf values of House、Cameraman and Peppers edges have reached a stable detection results, and they are lower than the Adpf values of Canny operator.It indicates that the edge quality detected based on ACO-PSO algorithm is superior to the operator detectors.In order to save time, the iteration was set at 15.

Fig. 2 .
Fig. 2. Statistics value of the best evaluation function in 20 iterations.(a) Lena; (b) House; (c) Cameraman; (d) PeppersIn order to verify the noise sensitivity of the algorithm, the salt and pepper noise, whose density is 0.1, was add into image the detection, results are shown in Fig.3.This algorithm can effectively eliminate noise and extract true edges.Traditional methods have their problems.For example, Sobel operator detection causes discontinuity while Canny operator detection causes severe false detection.And both of them cannot restrain noises in image or obtain complete true edges.So this algorithm has strong robustness.

Fig. 3 .
Fig. 3. Detection of Lena image after salt and pepper noise was add.(a) image with salt and pepper noise; (b) image of Sobel operator edge detection; (c) image of Canny operator edge detection; (d) image edge detected by ACO-PSO algorithm

Fig. 4 .
Fig. 4. Test results of standard images.(a) Canny operator method; (b) manual setting parameters; (c) the FCM cluster ACO algorithm; (d) algorithm in this paper

TABLE I .
CONTRAST OF IMAGE EDGE QUALITY (ADPF) BY OPERATOR METHODS

TABLE II .
ADPF VALUES OF DIFFERENT IMAGE EDGE DETECTION