A Modified Adaptive Thresholding Method using Cuckoo Search Algorithm for Detecting Surface Defects

There are various mathematical optimization problems that can be effectively solved by meta-heuristic algorithms. The improvement of these algorithms is that they carry out iterative search processes which resourcefully act upon exploration and exploitation in spatial domain containing global and local optima. An innovative robust Cuckoo Optimization Algorithm (COA) with adaptive thresholding is proposed to solve the problem of detection and estimation of surface defects on metal coating surfaces. The proposed method is developed through implementing changes to COA and improved the performance. For improving capability of local search as well to keep the global search effect, the enhanced methods such as level set is associated with the proposed method. Also, the method adapts dynamic step size, adaptively changing with the search process for improving the rate of convergence and the ability of local search. The algorithm performance is scrutinized from the experimental analysis and results. Also, the segmentation effectiveness is further enhanced by adapting suitable methods for preprocessing and post processing. The comparison and analysis of the results accomplished with the proposed method and results of earlier methods shows superior performance of the proposed method. Keywords—Thresholding; surface defect; optimization; image processing; coated surface


I. INTRODUCTION
The quality control is a significant feature of today"s highly competitive industry. Each manufacturing process output inspection is an imperative way to enrich the end product quality. The manual inspection of end products retards the whole procedure as it gets expensive, time consuming as well as impact the efficiency of human because of the unsafe atmosphere in industries. The inspection process has been automated and the methodology ought to be considered as resourceful layout of human intellect and comprehend together with rapidity of machine [1]. Automated visual inspection is an exceptionally imperative non-contact method in industries.
It detects diminutive defects which turn out as local anomalies relative to the adjacent background in the acquired image. A robust automated visual inspection method for identifying restrained defects in the pattern surface and the nondestructive testing technique become commonly used method for defect detection and classification. The microwave nondestructive testing technique [2] employed to detect defects in non-ceramic insulators. Currently, machine vision system has turn out to be the main stream nondestructive approach to resolve this kind of problem, reviewing its distinctiveness of quick response and non-contact. Accordingly, various algorithms have been developed to recognize and categorize the surface defect [3].
The method of active microwave thermography identifies the defects on steel surface and carbon fiber reinforced polymer based materials. The detection approach based on the computer vision technology make possible the compilation of surface quality insights and locates appropriate disruption all through the production process. The methods of defect detection could be organized into supervised and unsupervised manner. The supervised methods primarily depend on sufficient and standard set of training data. But, in exceptional instances, there exist an absolute defect dimensions set in an existent production environment. The unsupervised methods [4] on the basis of irregularity detection might be of immense practical significance, which is capable to find the anomalous regions via evaluation and comparison of local patches within the image. In general, existing methods for anomaly detection could be organized into three types such as, spectral, model based and statistical methods. Previously, statistical methods utilized to evaluate the texture through calculating spatial distribution of pixel intensities. The defects were detected with the first-order statistics in those approaches and the mean, variance and histogram based computations together with the second-order statistics depending upon the cooccurrence matrix. www.ijacsa.thesai.org Automated surface inspection is the field of utilizing the computer vision algorithms for surface inspection. The most surface defects are local variances or anomalies in homogeneous surface. The commonly used automated surface inspection algorithms [5] construct local features for surface defect detection. The statistical, structural, model based and filter based methods are the most important types of automated surface inspection methods. A statistical method determines the neighboring distribution of pixel standards and the structural methods form recurring patterns through dislocation and texture primitives.
The machine vision based method utilized for surface inspection as a non-contact detection technology in this decade which is capable to track the dynamic details of the object surface. The method makes use of the images confined by the camera for computing the target dimensions. The grey level of every pixel in the image characterizes the potency of the light reflected against the surface of the measured object. The pixels of an image correspond one-to-one with points on the surface of object and be utilized for computing the defects positions. For inspecting the surface defects of tunnels [6] this method has been applied. The new-fangled unidentified defects require restructuring the automated existing algorithms [7] so as to distinguish and categorize new defects, causing extended development cycles, impediments and have need of human endeavor toward sustaining the design and improvement of the system constantly.
In image analysis, an important process is thresholding, which turns down the color or grayscale image into binary. The simplest technique is thresholding to segment an image into regions exhibiting generic properties. The method constitutes black and white binary images from color or grayscale images with the intensity variation of all pixels to distinct values of zero or else one. Thresholding decreases the intensity of pixels lower than a definite value to zero (black), while the pixels higher than the selected value are specified as one (white). In image segmentation, for rapid evaluation the thresholding method is useful because of its ease and quick processing rate. The images might have different lighting conditions in different areas but utilizing a global threshold value may not be good choice, in such conditions the adaptive thresholding [8] is used.
In this paper we propose Modified Adaptive Thresholding Method using Cuckoo Search [9] Algorithm for Detecting Surface Defects, which is flexible to accord with these problems and further improves the segmentation performance. The thresholding technique will separate the image segments in to defected and non-defected regions. The proposed method is then compared with existing thresholding methods.

II. IMAGE THRESHOLDING AND BINARIZATION
Initially for defect detection, the color image is changed to grayscale and the thresholding method is used to get the appropriate black and white image. The defect is highlighted in a distinctive color as white and the rest of the coating as black.

A. Otsu's Method for Thresholding
Otsu"s method is considered as a basic method to adapt a threshold value of an image. Through maximizing the between-class variance, the Otsu"s method finds the optimum threshold as [10]. (1) where, the between-class variance given by (2) Where, the occurrence of probabilities of the two classes are and , the average of the two classes are and , the total average is , the foreground and the background pixels are separated using the threshold value.

B. Median-Based Extension of Otsu's Method
This method has been shown to be more vigorous in the resolving the threshold, in particular while in case of skewed and heavy-tailed distribution. The median-based Otsu"s method is functional using median values rather than the mean values of the gray scale level distribution. Xue and Titterington find the mean absolute deviation (MAD) [11] from the median on the way to estimate the distribution rather than the variance. The threshold is selected by where, is the median for foreground class and is the median for background classes which can be as follows, where, and are the sample median for and , respectively.

C. Adaptive Thresholding with PSO
The adaptive thresholding in general takes a grayscale or color image as input and outputs a binary image describing the segmentation. A threshold has to be calculated for each pixel in the image and for this the binary image pixels are used to calculate the threshold value. If the pixel value is lower to the threshold value then the image is set to background; or else it set to a foreground. This can be viewed as an optimization problem to obtain an optimal threshold value for the adaptive threshold method. Therefore, Particle swarm optimization (PSO) is used to get an optimal adaptive threshold value [12]. PSO is surrounded to predict the behavior of birds in search for nourishment on a cornfield or fish school. The technique can capably determine best or close to best solutions in excessive search spaces. The swarm molecule movement in the search space is demonstrated in the following equations: www.ijacsa.thesai.org From the equations (6) and (7), are the coefficients with the range of 2.0, are the independent random values developed in the limit between 0 and 1, is the velocity of i th particle. , represents the current position i and the optimal fitness value of the molecule at the present iteration, is the optimum global values in the swarm.

III. PROPOSED METHOD
A. Modified Adaptive Thresholding Method using Cuckoo Search Algorithm A highly efficient defect detection system is proposed for identifying surface defects on metal coatings. The different steps involved in the proposed method are shown in Fig. 1.The high resolution images are used for the processing. Adaptive thresholding [13] utilized by which the gray scale image is taken as input. A threshold value is automatically calculated at every pixel of image and when the value of each pixel falls under the threshold, it is set with the background value or else foreground value is set. The threshold value is optimized by the proposed Cuckoo Optimization Algorithm (COA) method, which quickly finds the optimal threshold value for segmentation. The steps involved in defect detection are depicted in the block diagram. Initially the images are subjected to preprocessing with Contrast Stretching method. The Cuckoo optimization method is used by which the each group fitness function is evaluated and an optimal threshold value is calculated. Then with the level set method, region segmentation is performed. The final step in processing is morphological operation which is used to refine the segmentation.

B. Preprocessing
It is an effortless method applied for image enrichment that takes effort by stretching the series of intensity values [14] incorporates to get better contrast in an image and extent preferred choice of values. The upper and lower pixel value limits must be specified before stretching can be performed over which the image is to be normalized. The lower and upper limits for 8-bit gray level images might be 0 and 255.
Consider the upper and lower limits v and u respectively. The highest and lowest pixel values [15] now present in the image as y and x respectively. The following function is used for scaling each of the pixels P in an image, where and are the output and input pixel intensities respectively at each individual pixel present in the image.

C. Cuckoo Optimization Algorithm (COA)
The COA local search involves, every cuckoo lays eggs surrounded by an explicit radius and that confides on the quantity of eggs, immigration of population performs global search. It is clear from the experiments exhibited, that COA [16] needs less number of iterations toward reaching the global optimum. Cuckoo Search Algorithm has some rules: a) Each of the cuckoo merely lay single egg by each instance while depot within arbitrarily nest preferred. b) Nests consisting of eggs with superior quality are considered as finest nest where about accepted above to subsequent formation. c) There is a fixed amount of host nest available. The probability in which the host bird detect the unfamiliar egg in its nest is taken as [0, 1] since the quantity of host nest obtainable is preset. The host bird moreover extinguishes the egg otherwise nest is disregarded whereas built a fresh nest.
Cuckoo Optimization Algorithm a) Initialize the habitat of cuckoo with some random points on the profit function at habitat ) (9) where, is an array of current living position or habitat of cuckoo b) Contribute some eggs to each cuckoo c) Define the Egg Laying Radius (ELR) for each cuckoo: (10) d) Let cuckoos lay eggs inside their consequent ELR e) Eradicate those eggs that are renowned by host birds f) Assess the habitat of every newly grown cuckoo g) Limit cuckoos maximum number in the location and eradicate those who live in worst habitat Group cuckoos and locate best group and choose goal habitat: h) Let new cuckoo population immigrate in the direction of goal habitat i) Stop if population size exceeds maximum iteration, if not, then go to step (b).
In Cuckoo Optimization Algorithm, the cuckoo with its egg prompt a optimization problem through candidate solution and consists the range =[ , , .., , , , …, ] whereas with its population size, the cuckoo on the 1"th position, the j describes the dimension of it. To evaluate each habitat a fitness function is used by the COA [17] and targets to normalize it. The cuckoos are produced randomly at the initial step [18].
Each one cuckoo lays numeral eggs in other birds nest contained by the explicit radius, KM. The value for cuckoo in the l"th position is / TE (15) where, is controller value of . is the amount of eggs within the cuckoo of l"th position whereas TE indicates entire eggs in population. The radius of egg at position p, can be represented as (16) The percent of low fitness cuckoo eggs are renowned which the host bird eliminates. If the size of population exceeds a maximum size provided, the low fitness weaker cuckoos are discarded. The existent cuckoo groups are partite into numerous groups. The average fitness is calculated for each group. The best group [19] [20] containing the finest point is considered as target point. The movement of cuckoos with reference to this point in view of the distance interim among their present or current positions, terminal point and diversion angle. The algorithm is terminated if the population size exceeds maximum number of iterations.

D. Level Set Segmentation for Region Segmentation
The Level-set methods are a conceptual framework for segmenting specific area using level sets as a tool for statistical analysis of surfaces and shapes. Initially the area is defined, then it evolved itself by values of pixels [21], it moves towards the object if the pixel value is same else it is not. So it is well suitable for analyzing the defected area. This method handles topological variation of surfacing boundary. The implicit representation is employed for contour representing zero level set R, that is, (R)=0 of the level set function . As the (a, b, t) the level set function is moved, it inflates, plunge, widen, etc. The level set functions is tend to be moved at first defining a velocity field S which illustrates by what means the contour points move within time. Next construct a primary value for the level set function, (a, b, t=0), stationed on the initial contour position and alter with time, the current contour is described as (a(t), b(t), t) = 0. In two dimensions the level set method amounts to describing a closed curve using a subordinate function . Г is denoted as the zero level set that corresponds to the actual position of the curve at a given frame of by = {(a, b) | (a, b) = 0}, moreover through the function , employs implicitly through utilizing level set function. The positive values inside the region are taken by the function [22] delimited with the curve and outside the region it takes negative values. The evolution equation for level set is obtained by manipulating to indirectly move R as (R) = 0 = . + = 0 (17) where, S is the speed function normal to the curve. It is said that the distance function inside the curve is negative and outside it is positive. A suitable speed function S is chosen and may segment an object in an image. The function is accelerated using standard level set segmentation [23][24] and can be represented as: The inflation inside the object is caused due to term 1 in the contour. The curvature of the contour is reduced by (viscosity) term. The final term is edge attraction which pulls the contour to the edges. The equation can be updated as follows: where, √ and √ are forward and backward differences, -current (target) level set function point of curve, initial level set point, -difference in time.

E. Post Processing by Morphological Operation
The final step for defect detection is post processing by morphological operation. Here, the morphological operation [25] termed opening is used on the binary or grayscale image by way of the structuring element. There must be a distinct structuring element object, while divergent to group of objects. There upon for both the cases the similar structuring element and the morphological open operation are used followed by dilation. The morphological operator is used to refine the segmentation, it allows to add or delete the unwanted information in border of defects and smoothing the area of the defect, it provide the best refining result. The above figures denote the processed output images of the two samples using the adaptive thresholding with cuckoo optimization, adaptive thresholding with PSO, Median based Otsu and Otsu"s Method. Fig. 2 and Fig. 3 represent the output segmented images of sample 1 and sample 2, respectively. The white portion of the image shows the defected area or uncoated regions and black portion represents coated area. The proposed method shows better detection compared to existing methods.

IV. RESULT AND DISCUSSION
This section comprises the proposed technique evaluation based on experimental results. The achievement of the proposed Adaptive thresholding with Cuckoo optimization is compared with the results obtained from adaptive thresholding with PSO, median based Otsu and Otsu"s method. In this regard, we used four performance measures such as sensitivity, specificity, accuracy and precision.
A. Parameter Calculation a) Sensitivity: It measures the proportion of actual positives that are suitably recognized. It is also referred as true positive rate or probability of detection. (21) b) Specificity: It measures the proportion of actual negatives that are suitably recognized. It is also referred as true negative rate. (22) c) Accuracy: Accuracy is defined as closeness of a measured value to a generally known or standard value.
The following tables and its corresponding graphical representation shows the proposed method is suitable for examining the coated and uncoated regions of metal surfaces. The results in Table I clearly showed that proposed method greatly outperformed other algorithms in terms of the sensitivity measure. Table II shows the performance  evaluation of proposed method for the specificity measures  and Table III shows the performance evaluation of accuracy measures. The precision measures are tabulated in Table IV.
The table values shows that adaptive thresholding based cuckoo method provided more robust results than other algorithms on the majority of the considered test input images. Fig. 4 and Fig. 5 show the graphical representation of proposed method with other algorithms, obtained from the experimental result using sensitivity measures and accuracy measures respectively. It is clear from the table and graph, the results obtained from the proposed method gives better result compared to other three techniques such as adaptive thresholding with PSO, median based Otsu and Otsu"s method for defect detection and segmentation. The proposed method yields much better results when considered the evaluation parameters.

V. CONCLUSION
This paper has presented comparison of the three existing techniques with the proposed method through calibrating its performance by means of the evaluation parameters. The Cuckoo optimization based adaptive thresholding method proposed is verified to be more appropriate for solving the problems, compared with conventional methods. Furthermore, the experimental results convey that the Cuckoo optimization is considered to be improved throughout the time taken or instance for generating the optimal solution. Hence, the proposed method exhibits superior performance for detecting the surface defects while comparing with the other three techniques.
In future, we plan to use other powerful optimization method like firefly optimization to the proposed method and then apply it to different types of metallic surface images.