# Quadratic Curve Fitting-Based Image Edge Line Segment Detection: A Novel Methodology
## 3 Edge Line Segment Extraction Based on Quadratic Curve Fitting
(**b**) The starting pixel of L, \(n_{1}\), is located at the middle position of set \(C_{i}\), and the ending pixel, \(n_{2}\), is located at the final position of set \(C_{i}\). (**c**) The starting pixel of L, \(n_{1}\), and the ending pixel, \(n_{2}\), are both located at the middle position of set \(C_{i}\). ```
Input : Contour \(C_{i}=\left\{(x_{j},y_{j})|j=1,2,3,...,n\right\}\), whose length is n; \(C_{i}\) the continuous and longest L in it; Output : The set R, which consists of the remaining pixels in the edge contours set \(C_{i}\) after deleting L
1 Initialization: Set variables \(Flag=0\), which is used to determine whether the remaining pixel sequence in \(C_{i}\) can form an edge contour after L is deleted; the minimum pixel threshold to form an edge contour is \(\eta\). if\(L\) goes from the \(C_{i}\) from the starting position to the middle position of \(n_{2}\), and \(n-n_{2}>\eta\)then
2 The pixel sequence from \(n_{2}\) to \(n\) forms an edge contour, which is stored in R. flag = 1;
3 elseif\(L\) from middle position \(n_{1}\) of \(C_{i}\) to the end position \(n\), and \(n_{1}>\eta\)then
4 The starting position to \(n_{1}\) sequence forms the edge contour, which is stored in R; flag = 1;
5 elseif\(L\) is in the \(C_{i}\) middle positionthen
6 if\(n_{1}>\eta\)then
7 The starting position to \(n_{1}\) sequence forms the edge contour, which is stored in R; flag = 1;
8 end if
9 if\(n-n_{2}>\eta\)then
10 The sequence from \(n_{2}\) to n constitutes the edge profile, which is deposited in R; flag = 1;
11 end if
12 if\(n_{1}\)\(\leq\)\(\eta\) and \(n-n_{2}\leq\eta\)then
13\(R\) is empty;
14 end if
15 else
16\(R\) is empty;
17
18 end if
```  
**Algorithm 2**The algorithm for removing the sequence L from \(C_{i}\). As can be seen from Algorithm 2, the final R obtained either contains one edge contour, two edge contours, or is empty. Step 5: Consider the edge contours in R as the new \(C_{i}\), and repeat the steps from Step 2 to Step 4 until the contour set of R that can be formed by the remaining pixels is empty (which indicates that the edge segments in the initial \(C_{i}\) that can satisfy the conditions in R are extracted). Step 6: For the edge contours in the whole image \(\left\{C_{i}|i=1,2,3,...,M\right\}\), Step 2 to Step 5 are repeated until the M contours are traversed to obtain the complete set of edge segments in the whole image \(D=\left\{D_{i}|i=1,2,3,...,M\right\}\). A complete representation of the algorithms in Step 1 to Step 6 above that use pseudocode are illustrated by Algorithm 3:```
Input : The image to be detected; Output : The complete set of edge contour segments D in the image;
1 Detection of edge features in the input image using the Canny operator;
2 Finding edge contours by Moore-Neighbor algorithm;
3 The length is less than one-twentieth of the image size edge contours are deleted to obtain the edge contour set \(\left\{C_{i}|i=1,2,3,...,M\right\}\);
4 Set R to null;
5 for each edge profile \(C_{i}\)do
6 assign \(C_{i}\) to R;
7 while1 do
8 ifR is emptythen
9 End of algorithm;
10
11 end if
12 for each edge profile in R (initially there is only 1 in R)do
13 Finding the continuous and longest edge line segment L;
14 ifL can be foundthen
15 Deposit L to \(D_{i}\);
16 Remove L from the current contour;
17 ifthe remaining pixels of the current contour form a new outlinethen
18 R set to empty;
19 Deposit new contours in R;
20
21 end if
22
23 end if
24
25 Deposit \(D_{i}\) to D;
26
27 end for
```

**Algorithm 3**Edge line segment extraction algorithm based on quadratic curve fitting. ## 4 Experimental Analysis

The quadratic curve-based edge line segment detection algorithm (named the QR-LSD method) proposed in this paper is tested by real images and compared with the LSD straight line segment detection algorithm [10]. In order to make the algorithm more fair and reasonable in the experimental comparison, both the algorithm in this paper and the LSD algorithm are implemented in the same programming language.