Hybrid Technique Used for Straight Line Detection

(DBM) و ةينقت Genetic Developed Baron’s Method (GDBM)  ينقتلا تقبط ة ىلولأا مت امنيب ،يه امك ءارجإ تلايدعتلا ضعب ريوطتل ةيناثلا ةينقتلا . امأ يهف ةثلاثلا ةينقتلا ةروطملا ةيناثلا ةقيرطلاو ةينيجلا ةيمزراوخلا نيب ام نيجهت . تقوو ةقدلا باسح مت ةثلاثلا قرطلا ذيفنت دعب ةقيرط لكل ذيفنتلا ترهظأو  جئاتنلا نأ ةحرتقملا ةينيجهلا ةقيرطلا ققحتو ةلوبقم اهتعرس ثحبلا اذه يف ءادأ  يلاع تطعأو لصت طخلل فاشتكا ةبسن ىلإ  90% . ةغل تمدختسا MATLAB  ثحبلا اذه تايجمارب ذيفنت يف .

"The Optimization of Edge and Line detections for forest image analysis", was suggested by Zhiling Long and Joseph Picone who designed an objective metric to evaluate the performance of edge and line detectors and then optimized the performance of their image analysis system using this metric. Their best system resulted in an error rate of 29%, and hand an acceptable insertion rate [4].

2-Hough Transform Method
Hough transform (HT) is a powerful tool for finding parameterized shapes in digital images. It is capable of detecting straight lines, circles, ellipses and other curves in both binary and gray scale image. The Hough transform is designed specifically to find lines, it is an algorithm that will take a collection of points, the primary advantage of the Hough transform is that it reduces the search time for finding lines and the corresponding set of points [5]. The original algorithm which was published by P.V.C. Hough quite a long time ago in 1959. It's procedure is based on the transformation of the original image pixel-by-pixel into the Hough-space adequate to the actual parameterization [6].
Hough transform based methods are robust over different image qualities since Hough transform converts a difficult global detection problem in image space into a more easily solvable peak detection problem in the Hough transform parameter space; therefore, they can deal with noise, degradation, and partial disconnection, even in complicated background [7] . In order to understand the Hough transform, first consider the normal representation of a line: If have been a line in our row and column (rc) based image space, we can define that line by (P), the distance from the origin to the line a long a perpendicular to the line, and ( ) the angle between the r-axis and the p-line, for each pair of values of p and  we have defined a particular line [3,7].show figure (1).
In an image analysis context, the coordinates of the point(s) of edge segments (ie (xi,yi)) in the image are known and, therefore, serve as constants in the parametric line equation, while (P) and (θ) are the unknown variables we seek. If we plot the possible (P, θ) values defined by each (xi, yi), points in Cartesian image space map to curves (i.e. sinusoids) in the polar Hough parameter space. This point-to-curve transformation is the Hough transformation for straight lines. When viewed in Hough parameter space, points which are collinear in the Cartesian image space become readily apparent as they yield curves which intersect at a common (P, θ) point. [1] r (x) The line of interest P  c (y)

3-Baron's Method
Baron Lic suggested a new method for detecting straight line in image depending on Hough transform. This method supposed that there are straight lines for all (P,  ) values on screen, and calculated the range of the corresponding actual existing line with suppose line if the rate of corresponding is high. This refers to finding line in current (P, ), and the following detail explain of this method [8]:-Let us define the distance di in image space, which is Euclidean, as the minimum distance between point Pi and the line represented by the parameters P and θ, as follows: Where Pi is the position vector of point pi and Po is the position vector of the closest point of the line to point pi, this point is readily obtained as follows: The extraction can be formulated as the following optimization problem: Z(P, θ) = Where n is the number of points in the set and di is given by equations (2), (3). This equation makes it possible to find a line, which has the maximum likelihood in the set of points while searching in the parameter space. This equation has many local optima and is equivalent to Hough transform. This method was represented by algorithm as follows: 1-The value of P and θ would be specified as: where n: represents number of white pixels. p: represents the P.,  : represents the  . di : Eclides distance.

4-Applied Methods
In this research different methods have been used to detect straight line: the first method is traditional (prevailing used) represented by Hough Transform Method (HTM). The second method is newest method (rarely used) which is represented by Baron's method (BM), the third method is Baron's development method (BDM), and the last method is intelligent method using genetic algorithm (GA).

4-1 Hough Transform Method (HTM)
The Hough Transform Method (HTM) has been used to detect the straight lines as it has been applied to each texture separately with an angle of about [0-180]. All the pixels, which are located on rectitude and at the same angle, have been detected. The method mentioned in section (2) has been followed as well as the application of the equation (1) to all the image's pixels. We also obtained a matrix with three columns where the first dimension represents the number of the pixels located on rectitude, the second dimension represents the straight line inclination angle and the third dimension is the x axis of the pixel.

4-2 Baron's Method (BM)
Baron's Method is one of the newest straight line detection method, this method depend on (HTM) concepts, but it applies straight-line equation in polar (HT). It supposes that there is a straight line in each place in search space. The corresponding between image's pixels and fanciful line's pixel (in polar HT space) has been calculated. If the corresponding is high that indicated to find straight line in location(p, )and the converting to Cartesian and found (x, y) that equivalents (P, ) in polar HT.
This method has a good property, represented by accuracy of the straight lines number and the accuracy to find locations of the line. At the same time it is suffering from a number of weak points. We can specify it as following points : 1. The method hasn't any ability to detect vertical straight line in search space. 2. The line has been detected in this method consists of a number of pixels which are more than aailable number of pixels that make actual line.

4-3 Developed Baron Method (DBM)
Some development and modification has been performed to the previous method to process a weak points and obtained better results and more accuracy; it is called Developed Baron method (DBM), which consists of the following steps:-1-The value of P and  would be specified as : lx, ly : represent matrix dimensions 2-Calculate the function: where: n : represents number of white pixels., p : represents the P.
 : represents the  ., di : Eclides distance .   (2)(3) gives the ability of obtaining a better corresponding rate (between actual line and fanciful line) by checking (di) value,when di=0, this means prefect corresponding has been done for pixel otherwise ,when di≠0 the corresponding has been checked if it is around the specific user value this means corresponding has been done, otherwise pixel will be ignored .

4-4 Genetic Developed Baron Method (GDBM )
We can observe by executing the two traditional methods that the ratio of their accuracy is not satisfactory enough. The first method detects the straight line, but it does not provide accuracy as regard to the number of the actual straight lines because it gives fanciful lines near to the actual line. Accordingly we have significantly more straight lines than the actual number.
The second method offers a relatively accurate numbers of lines after having a suitable decision on the ratio of the symmetric pixels and this depends on the trial and error procedure being used. Notice that the execution of this method takes time. In order to get more efficient execution the GA has been used since the genetic algorithm is considered as one of the means for achieving optimal output for finding out the optimal solution or the nearest to the optimal as well as the ability to deal with research of huge and complicated area. According to what have been mentioned above we arrived at a solution where we can hybridize the BDM with GA and because this method offers relatively good and accurate results as well as the objective function enables us to use it in the genetic algorithm. The following are the steps that specify the genetic algorithm elements used with the GBDM method.

a-Creating Initial Population
The population consists of a number of individuals detected by the algorithm designer and according to the nature of the problem. In this work population has been detected by 50 chromosomes. These chromosome consists of a number of values (genes) whose lengths are detected according to the problem. The chromosome, in this work, has been represented by the following Figure:  where the range of P gene is between (0-142) and the range of  gene is between (0-180) degree .

b-Encoding
The chromosome which was explained in the previous step represented by a binary encode. Each gene is represent by 9 bit to accommodate a maximum value for P and  ( the maximum value of  =180 and the maximum value of P =142).

c-Evaluation of The Chromosome
In the genetic algorithm the chromosome is evaluated by the fitness value in order to check the kind of the solution, therefore, each chromosome (which is born in an initial population or through the antecedent generations) has a fitness value related to the objective function .In this work, individual is evaluated by the number of the pixels. Individual with high pixels will get high corresponding, whenever the number of pixels increase we will gets the best result ,which means that objective function is maximum function and thus the fitness is equal to the objective function as follows:- Fitness degree depending on threshold is specified by a user. This value is different from an image to another. The principle of trial and error is being used to detect this value until we arrive at the best decisions.

d-Selection
The Elitism method[ ]has been used to select a number of the current population individuals to represent the parents of antecedent generation. The selection from the individuals to represents the parents depend on the value of the fitness function for every individual. In this work a number of good chromosome has been copied to antecedent generation, the number has been specified by five chromosomes (best Chromosome: P  chromosome has been copied to antecedent). The rest of the parent are selected by the Roulette Wheel Selection method.

e-Crossover
Crossover between parent has been done to produce a new generation that represents the beginning of antecedent genetic cycle.Two-point crossover has been used to suitable chromosomes length,the two point position are located randomly and the crossover ratio was decided to be (0.9) .

f-Mutation
Mutation has been applied to get a chromosome that possesses new characteristics which have not been formed before from the previous generation, in order to extend the possible soloution area. The flip bit mutation method has been used, the mutation ratio was decided to be (0.3)after trying different values.

g-Stop Criterion
The stop criterion in the GA decides whether the algorithm continues researching or stop. The stop criterion is depend on two approaches: generations number and fitness threshold. Each fitness value for chromosome is compared with a fitness threshold and according to the result of comparison the number of the straight lines in the image is specified, when specific number of straight lines are detected, stop the calculations..

4-5 Algorithm Evaluation
To evaluate the proposed algorithm, we calculate the average precision using the following equations: The equation (7) calculate slice's accuracy that contain straight lines, the term ( slicei _lines) represents the actual number of straight line existence in slice i, while the term ( detected_lines) represents the number of detected straight lines in slice i ,and n represents a number of slices that contain straight lines.The equation (6) calculates slice's accuracy average of image by divided the summation of accuracy rate for all slices on slices number.

4-6 Discussion of results
The line detection based on (HTM ,DBM,GDBM) are carried out for the same sample (the slices are obtained after segmentation step). A threshold of (50 pixels) for the pixels number are used to indicate a straight line. The comparison between HTM, DBM,GDBM and actual lines number is shown in Figure (3) graphs a, b, c, d respectively, we notice that the results of graphs (c and d) are closed to each other, because they use the same technique (objective function), and notice that a graph c is a little bit closed to graph d, from the direction of actual number of lines and estimated by the algorithms and it could be considered the optimal result. The Figure (4) represents the average precision for each method by applying the equations mentioned in section (4)(5), the GDBM give perfect detection (precision=1). So the proposed hybrid method (GDBM) is considered the best method for the line detection.  (5) that the execution time for the HTM method is less than 1 second ,while the execution time for GDBM method is in the range of (20-800) second ,and the execution time for DBM is in the range of (40-999) second .Notice that GDBM combined the benefit of the accurate result with acceptable execution rate, therefore this method represents the best compared to another two methods. To give more details about the results applied methods, detected lines will be redrawn again for each slices. These can be clearly seen in Figures (6), (7), (8).

Future Works
-Applying the techniques used in this research with hybridized Neural Network techniques to get high performance -Use the GDBM method in medicine fields.