<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.3 20210610//EN" "https://jats.nlm.nih.gov/publishing/1.3/JATS-journalpublishing1-3.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.3" xml:lang="en" article-type="research-article"><front><journal-meta><journal-id journal-id-type="publisher-id">jcse</journal-id><journal-title-group><journal-title>Journal of Computational Science and Engineering</journal-title></journal-title-group><issn>1710-4068</issn><publisher><publisher-name>Advancersin</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="publisher-id">jcse-v31-a04</article-id><article-categories><subj-group subj-group-type="heading"><subject>Research Article</subject></subj-group></article-categories><title-group><article-title>Research on the Lane Line Detection Method Based on Image Processing</article-title></title-group><contrib-group><contrib contrib-type="author"><name name-style="western"><surname>Jiang</surname><given-names>Junhao</given-names></name><xref ref-type="aff" rid="aff-1"/></contrib><contrib contrib-type="author"><name name-style="western"><surname>Fang</surname><given-names>Luhao</given-names></name><xref ref-type="aff" rid="aff-1"/></contrib><contrib contrib-type="author"><name name-style="western"><surname>Sun</surname><given-names>Songsong</given-names></name><xref ref-type="aff" rid="aff-1"/></contrib><contrib contrib-type="author"><name name-style="western"><surname>Wang</surname><given-names>Yanxiang</given-names></name><xref ref-type="aff" rid="aff-1"/></contrib><contrib contrib-type="author"><name name-style="western"><surname>Yu</surname><given-names>Zexi</given-names></name><xref ref-type="aff" rid="aff-1"/></contrib><contrib contrib-type="author"><name name-style="western"><surname>Chen</surname><given-names>Peijiang</given-names></name><xref ref-type="aff" rid="aff-1"/></contrib></contrib-group><aff id="aff-1">School of Mechanical and Vehicle Engineering, Linyi University, Linyi 276000, China</aff><pub-date publication-format="electronic" date-type="pub" iso-8601-date="2017"><year>2017</year></pub-date><volume>31</volume><fpage>879</fpage><lpage>881</lpage><permissions><copyright-statement>2017 © The American Computational Science Society.</copyright-statement><license license-type="open-access" xlink:href="https://creativecommons.org/licenses/by/4.0/"><ali:license_ref xmlns:ali="http://www.niso.org/schemas/ali/1.0/" start_date="2021-11-26">https://creativecommons.org/licenses/by/4.0/</ali:license_ref><license-p>This article is licensed under the Creative Commons Attribution 4.0 International license (CC BY 4.0), which permits sharing and adaptation, including commercial reuse, subject to attribution, a link to the license and an indication of changes. Third-party material separately credited with different terms is governed by the license or rights notice stated for that material.</license-p></license></permissions><self-uri content-type="fulltext" xlink:href="https://www.advancersin.org/jcse/articles/jcse-v31-a04/index.html"/><self-uri content-type="pdf" xlink:href="https://www.advancersin.org/jcse/articles/jcse-v31-a04/jcse-v31-a04.pdf"/><abstract><p>With the development of intelligent driving technology, the performance of lane departure warning system is constantly improving. As the base of lane departure warning system, lane line detection is of great importance. In general, lane lines can be divided into straight lines and curved lines. Compared with the straight lane line, the detection of curved line is more difficult with less method. But as the machine vision and the progress of image processing technology of computer, the method of lane line detection is constantly increasing and updating. MATLAB is one of the primary software aiming to the development of computer vision system and image processing with internal image processing toolbox which provides effective functions to accelerate the procedure of lane line detection. Based on the image processing toolbox of MATLAB software, this paper uses the threshold segmentation, morphological processing and least square method to realize the detection and extraction of curved lane lines.</p></abstract><kwd-group><kwd>Curved lane line</kwd><kwd>Threshold segmentation</kwd><kwd>Morphological processing</kwd><kwd>MATLAB</kwd></kwd-group></article-meta></front><body>
    <sec>
      <title>1. Introduction</title>
      <p>With the increasing number of car ownership in our country, people's demand for car driving safety is also increasing. With the rapid development of computer technology, the assistant driving system arises at the historic moment, and lane detection, as an important part of the auxiliary driving system, has been deepened in the field both at home and abroad.</p>
      <p>Lane detection is to process the road image by vehicle camera, and extract the lane characteristics and obtain the lane image through the corresponding method. It is concluded that the detection method plays a pivotal role in the implementation of lane detection.</p>
      <p>Lane shape is mainly straight and curved, the main content of this paper is about the detection method of curved lane. The detection method of curved Lane generally has the following steps: the original RGB image captured by camera is transformed into gray image, and the binarization of image is processed by threshold segmentation, and then the edge of lane is detected. Finally, lane line is extracted[1].</p>
      <p>This paper abandons the edge detection steps in the process and increases the morphological processing step, Which makes the image processed by threshold segmentation less noise, and highlights the target image contour. Finally, the curve lane is fitted by the least square method and extracted into the original image.</p>
      <p>The image processing toolbox of MTALAB has rich image processing functions and methods, which saves a lot of time for the research of detection</p>
    </sec>
    <sec>
      <title>methods. The steps in this paper make use of the</title>
      <p>function of MATLAB, which greatly improves the efficiency of the algorithm.</p>
    </sec>
    <sec>
      <title>2. Threshold Segmentation</title>
      <p>Threshold segmentation is a part of image preprocessing, and the key is to get a suitable threshold. Based on this threshold, the original image is transformed into binary image. The commonly used threshold segmentation methods include global threshold method, Ostu threshold method, iterative threshold method, etc[2].</p>
      <p>Global threshold method: by giving the whole image with the same threshold T, when the pixel value in the image is greater than T, the pixel is considered as the target object; otherwise, that is, the pixel less than Tis regarded as the background object.</p>
      <p>The binarization of image should be satisfied with the demand, as shown in Equation 1. (1) Where, f(x, y) is the pixel value of any pixel in the image. Based on the MATLAB global threshold method, usually through the observation of gray image histogram, after basically determining the gray level of the histogram trough, then using this point as the global threshold to divide the target and</p>
    </sec>
    <sec>
      <title>background.</title>
      <p>The global threshold method is simpler and faster than the other two methods. However, when the number of histogram trough is large, the accuracy is greatly reduced and the adaptability is poor. Ostu threshold method: the derivation of the algorithm is based on gray histogram and the least squares method. The variance between the</p>
    </sec>
    <sec>
      <title>background and the target in the gray image is shown</title>
      <p>in Equation2. (2) Among them, μ is the average gray value of the image, μ0 is the average gray value of the background part, μ2 is the average gray value of the target part, a is the probability of the appearance of the</p>
    </sec>
    <sec>
      <title>background part, b is the probability of the target</title>
      <p>part. Ostu method is very sensitive to noise and target 1, ( , )( , ) 0, ( , ) f x y Tg x y f x y T   2 2 2 02( ) ( ) ( )k a b       </p>
      <p>size, simple in calculation and fast in calculation, and is widely used.</p>
      <p>Figure 1. Result of threshold segmentation.</p>
      <p>The iterative threshold method is as follows. Firstly, set the reference thresholdT0, and select an initial prediction thresholdT1. Secondly,T0 is used to segment the image, and the background part and the target part with T0 as the threshold are obtained. The set of background pixels is P0, and the set of the target pixels isP1.Thirdly,the average gray values U0 and U1of P0and P1 are calculated respectively, and new prediction threshold is generated T2=(U0+U1)/2.Fourthly, repeating second steps and third steps, when |T2-T1|&lt;T0, terminating the cycle, the result T2 is used as the final result[3]. The optimal threshold under the iterative threshold method.</p>
      <p>Compared with the Ostu method and the global threshold method based on gray histogram, this method is more adaptable. Therefore, in this paper, the iterative threshold method with better effect is selected by comparing the results of the three</p>
    </sec>
    <sec>
      <title>methods. The threshold segmentation results of the</title>
      <p>three methods are shown in Figure 1,it can be seen that the binary image obtained by iterative threshold method is better than other two methods[4].</p>
    </sec>
    <sec>
      <title>3. Morphological Processing</title>
      <p>Mathematical morphology is a discipline based on set theory. In image processing, it can simplify the image processing data and remove the incoherent structure while keeping the original shape feature of the image[5]. It can be used to suppress noise, feature extraction, and image segmentation and other image processing problems. In the binary image obtained by the iterative threshold method, there are many discontinuities in the target image, which can be connected by dilation operation of morphology.</p>
      <p>After dilation, the image is shown in Figure 2. It can be found that the original broken contour of the target image is connected, but more noise is also introduced.</p>
      <p>Figure 2. Result of dilation operation.</p>
      <p>Then through the opening operation of noise elimination, the MATLAB has a variety of image processing functions for binary image denoising, this paper uses the function“bwareaopen”, relative to imopen, imtophat and other functions, the function is simple[6].</p>
      <p>The denoised image is shown in Figure 3.</p>
      <p>Figure 3. Result of denoising operation.</p>
    </sec>
    <sec>
      <title>4. Lane Feature Points Acquisition</title>
      <p>By separating the left and right lane lines in the image, traversing the left image or the right image in turn, searching for non-zero pixels, obtaining the</p>
      <p>pixel coordinates, fitting the coordinates, and displaying the lane line position in the image. The left and right lane lines are greatly disturbed by other non target interference in the image. It can be seen from Figure 3 that it is difficult to avoid the appearance of the sky in the image captured by the general camera, which causes great interference to the lane extraction. Through the subtraction operation of the image, the left and right lane lines can be extracted separately, and based on the MATLAB image processing toolbox, it has very high efficiency.</p>
      <p>The basic steps are as follows. Firstly, extracting the approximate area of the left and right lane lines respectively. Secondly, calculating the number of non-zero pixels in the extracted region. Thirdly, removing lanes as small targets. Fourthly, using the subtraction operation between the Figure 3 and the image obtained by step 3and getting the lane line.</p>
      <p>Through the above steps, the left and right lane lines can be separated from the original image, and then the lane can be acquired. The pixel size of the left lane image is consistent with the original image, while the one Lane often exists on the one side of the image, so we only traverse the half image when we traverse the image. We can preset two empty matrices when we get the lane pixels. Using the powerful matrix processing function ofMATLAB, the pixel coordinates can be quickly stored in the matrix every time the lane pixels are searched. Finally, each preset empty matrix stores the abscissa or ordinate of the lane line feature points.</p>
      <p>Figure 4. Result of curve lane line.</p>
    </sec>
    <sec>
      <title>5. Least Square MethodFittingLane Line</title>
      <p>The least square method is a class of mathematical optimization, which seeks the best function matching of data by minimizing the square of error. In the image, the target curve function is assumed to be y=g(x), For the detected Lane characteristic point (xi,yi), the error corresponding to the target curve is g(xi)-yi.So the sum of squared errors corresponding to all feature points is shown in Equation 3[7]. It is the expression of least square method. (3) In the toolbox of MATLAB image processing, the least square fitting can be realized by the two functions “p=polyfit(x,y,n)”, “yi=polyval(p,xi)”.</p>
      <p>Finally, the curve lane is fitted and fed back to the original image, as shown in Figure 4. As can be seen from Figure 4, the fitting curve and lane line almost coincide.</p>
    </sec>
    <sec>
      <title>6. Conclusion</title>
      <p>In this paper, the feature points of lane are searched and obtained by traversing the image, the previous morphological processing indirectly enhances the accuracy of feature points and the model of lane line is fitted on the basis of these points, which has reliable accuracy. However, this method also has shortcomings that relies heavily on feature points. In complex road conditions and the image noise is serious, the error of feature points is larger, the effect is not ideal, and the robustness is poor. However, for most road conditions, good detection results can be obtained.</p>
      <p>In the process of extraction of lane line feature points, the method of judging the lane line area is more complex, and of poor adaptability, which is the mainly disadvantage of the study. By introducing efficient intelligent algorithm, the lane area can be obtained quickly and accurately, and the interference introduced by noise can be reduced. Based on the idea, we will expand the application of the procedure mentioned above by further study.</p>
    </sec>
    <sec>
      <title>Acknowledgement</title>
      <p>This research was financially supported by the Undergraduate Training Programs for Innovation and Entrepreneurship of Linyi University (No. 201710452061), and the Science and Technology Planning Project of Higher Education of Shandong Province (No. J16LB69), the Doctoral Scientific Research Startup Foundation of Linyi University (No.</p>
      <p>LYDX2016BS081), People’s Republic of China.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref-001">
        <mixed-citation>[1] D.X. LI. Lane Detection and Departure Warning Based on Machine Vision, Master Thesis, Shandong University, Jinan, China, (2012): 48~49.</mixed-citation>
      </ref>
      <ref id="ref-002">
        <mixed-citation>[2] T. Lei, Y.Y. Fan, X.P. Wang, L.C. Wang. Journal of computer Applications,19 (2009): 440~441.</mixed-citation>
      </ref>
      <ref id="ref-003">
        <mixed-citation>[3] D. Yang. MATLAB image processing actual combat[M], Tsinghua Press, (2013):227~231.</mixed-citation>
      </ref>
      <ref id="ref-004">
        <mixed-citation>[4] X.J. Sun,H. Li, J.X. Jiao. Journal of Military Transportatity University, 16(2014): 57~58.</mixed-citation>
      </ref>
      <ref id="ref-005">
        <mixed-citation>[5] Y. Xu, T. Lei.Journal of the China Railway Society,31(2009):107~108.</mixed-citation>
      </ref>
      <ref id="ref-006">
        <mixed-citation>[6] Q. Zhang, J. Zhan, S. Chen. Detailed description of MTALAB image function and its application[M], Publishing House of Electronics Industry, (2011) :360~362.</mixed-citation>
      </ref>
      <ref id="ref-007">
        <mixed-citation>[7] M. Qin, A Research of Lane Detection and Tracking Based on Machine Vision, Master Thesis, Ocean University of China, Tsingtao, China (2012) : 29~30. min [ ( ) ] nn ii g xi yi  </mixed-citation>
      </ref>
    </ref-list>
  </back>
  <floats-group>
    <fig id="fig-001" position="float">
      <graphic xlink:href="figures/fig-001.jpg"/>
    </fig>
    <fig id="fig-002" position="float">
      <graphic xlink:href="figures/fig-002.jpg"/>
    </fig>
    <fig id="fig-003" position="float">
      <graphic xlink:href="figures/fig-003.jpg"/>
    </fig>
    <fig id="fig-004" position="float">
      <graphic xlink:href="figures/fig-004.jpg"/>
    </fig>
    <fig id="fig-005" position="float">
      <graphic xlink:href="figures/fig-005.jpg"/>
    </fig>
  </floats-group>
</article>
