{"id":1967,"date":"2014-02-05T17:32:44","date_gmt":"2014-02-05T17:32:44","guid":{"rendered":"https:\/\/www.anagram.at\/en\/diplomarbeit\/line-extraction\/"},"modified":"2014-02-05T17:32:44","modified_gmt":"2014-02-05T17:32:44","slug":"line-extraction","status":"publish","type":"page","link":"https:\/\/www.anagram.at\/en\/diplomarbeit\/line-extraction\/","title":{"rendered":"Line Extraction"},"content":{"rendered":"<p><body><br \/>\n<!--Navigation Panel--><br \/>\n<b> Next:<\/b> <a name=\"tex2html517\" href=\"https:\/\/www.anagram.at\/diplomarbeit\/correspondence-analysis-2\/\">Correspondence Analysis<\/a><br \/>\n<b> Up:<\/b> <a name=\"tex2html513\" href=\"https:\/\/www.anagram.at\/diplomarbeit\/methods\/\">Methods<\/a><br \/>\n<b> Previous:<\/b> <a name=\"tex2html507\" href=\"https:\/\/www.anagram.at\/diplomarbeit\/edge-detection\/\">Edge detection<\/a><br \/>\n<!--End of Navigation Panel--><\/p>\n<h1><a name=\"SECTION00440000000000000000\"\/> <a name=\"M_lineextraction\"\/><\/p>\n<p>Line Extraction<br \/>\n<\/h1>\n<p>\nA line is defined as a set of points which are connected and form a straight line. It can be completely described through the start point and end point. There are different techniques for finding straight lines. The most popular one is the <i>Hough transform<\/i>. The basic idea of this technique is to find curves that can be parameterized, like lines, polynomials, circles, etc. in a suitable parameter space. The detection of straight lines in images will be shortly discussed because it is the main feature used in the proposed approach. Let us assume that the line is described in parameterized form <!-- MATH\n $r = xcostheta+ ysintheta$\n --><br \/>\n<img loading=\"lazy\" width=\"161\" height=\"35\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img208.png\" alt=\"$ r = xcostheta+ ysintheta$\"\/>, where <img loading=\"lazy\" width=\"14\" height=\"19\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img161.png\" alt=\"$ r$\"\/> is the perpendicular distance from the origin and <img loading=\"lazy\" width=\"14\" height=\"20\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img183.png\" alt=\"$ theta$\"\/> the angle of the <img loading=\"lazy\" width=\"15\" height=\"19\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img25.png\" alt=\"$ x$\"\/>-coordinate with the normal. For any point <!-- MATH\n $p = (x_i,y_i)$\n --><br \/>\n<img loading=\"lazy\" width=\"93\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img209.png\" alt=\"$ p = (x_i,y_i)$\"\/> on a straight line, <img loading=\"lazy\" width=\"14\" height=\"19\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img161.png\" alt=\"$ r$\"\/> and <img loading=\"lazy\" width=\"14\" height=\"20\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img183.png\" alt=\"$ theta$\"\/> are constant. Points in the cartesian image space maps to curves in the polar Hough parameter space. This point-to-curve transformation is called Hough transform. Points which are collinear in the image space intersects at a common point <!-- MATH\n $(r,theta)$\n --><br \/>\n<img loading=\"lazy\" width=\"45\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img210.png\" alt=\"$ (r,theta)$\"\/>. Figure <a href=\"#Hough\">3.8<\/a> shows how three lines are mapped into the parameter space. The transformation is implemented by quantizing the Hough parameter space into finite intervals, called accumulator cells. For every <img loading=\"lazy\" width=\"51\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img211.png\" alt=\"$ (x_i,y_i$\"\/>, the parameters <!-- MATH\n $(r,theta)$\n --><br \/>\n<img loading=\"lazy\" width=\"45\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img210.png\" alt=\"$ (r,theta)$\"\/> are computed and the accumulator at position <!-- MATH\n $(r,theta)$\n --><br \/>\n<img loading=\"lazy\" width=\"45\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img210.png\" alt=\"$ (r,theta)$\"\/> is incremented. Peaks in the parameter space represent a straight line in the image space.<\/p>\n<div align=\"CENTER\"><a name=\"Hough\"\/><a name=\"1652\"\/><\/p>\n<table>\n<caption align=\"BOTTOM\"><strong>Figure 3.8:<\/strong><br \/>\nHough transform, the left image shows three lines in the image space and the right image shows the corresponding lines in the parameter space<\/caption>\n<tr>\n<td>\n<div align=\"CENTER\">\n <img loading=\"lazy\" width=\"443\" height=\"165\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/hough.jpg\" alt=\"Image hough\"\/><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>The main disadvantage is that it needs a lot of computational effort to transform the image into the hough-space and the output is a parametric description of a line, thus the starting and end point are not known and it needs some comparisons to find the starting and end point. Another way is to define a convolution mask which detects lines. The main disadvantage with this method is that every mask only finds lines that have a certain direction. <\/p>\n<p>Another approach is to follow edge points iteratively and use the attitude of the found edge points as a reference to decide whether the following set of edge points seems to be in a line with the same attitude or not. The proposed work uses such a method. <\/p>\n<p>A linear list is used to store the lines. A list element (line) consists of the following attributes<\/p>\n<dl>\n<dt><strong>Point start<\/strong><\/dt>\n<dd>Stores the image coordinates of the point, where the line has its origin.<\/p>\n<\/dd>\n<dt><strong>Point end<\/strong><\/dt>\n<dd>Stores the image coordinates of the point, where the line ends.<\/p>\n<\/dd>\n<dt><strong>Point cp <\/strong><\/dt>\n<dd>The compare-point stores the image coordinates of the point, that is used to calculate the disparity between this line and the corresponding line in the other image. In other words, if <img loading=\"lazy\" width=\"11\" height=\"20\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img7.png\" alt=\"$ l$\"\/> is the line in the left image and <img loading=\"lazy\" width=\"15\" height=\"17\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img8.png\" alt=\"$ l'$\"\/> its corresponding line in the right image, then the cp for <img loading=\"lazy\" width=\"11\" height=\"20\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img7.png\" alt=\"$ l$\"\/> is defined as<\/p>\n<p\/>\n<div align=\"CENTER\"><!-- MATH\n begin{equation}\nbegin{aligned}\nlrightarrow cp_x = frac{lrightarrow start_x + (lrightarrow end_x - lrightarrow start_x)}{2} \nlrightarrow cp_y = frac{lrightarrow start_y + (lrightarrow end_y - lrightarrow start_y)}{2}.\nend{aligned}\nend{equation}\n --><\/p>\n<table cellpadding=\"0\" width=\"100%\" align=\"CENTER\">\n<tr valign=\"MIDDLE\">\n<td nowrap=\"nowrap\" align=\"CENTER\"><img loading=\"lazy\" width=\"397\" height=\"104\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img212.png\" alt=\"begin{equation*}begin{aligned}lrightarrow cp_x = frac{lrightarrow start_x +...&#10;... + (lrightarrow end_y - lrightarrow start_y)}{2}. end{aligned}end{equation*}\"\/><\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p><br clear=\"ALL\"\/><\/p>\n<p\/>\nThe cp for <img loading=\"lazy\" width=\"15\" height=\"17\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img8.png\" alt=\"$ l'$\"\/> is defined as the point of intersection between a horizontal line <img loading=\"lazy\" width=\"15\" height=\"20\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img213.png\" alt=\"$ h$\"\/>, that has its origin in <img loading=\"lazy\" width=\"68\" height=\"35\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img214.png\" alt=\"$ l-&gt;cp$\"\/>, and <img loading=\"lazy\" width=\"15\" height=\"17\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img8.png\" alt=\"$ l'$\"\/>. <\/p>\n<\/dd>\n<dt><strong>Real direction<\/strong><\/dt>\n<dd>Stores the direction of the line, which is computed by adding up the directions of the edge pixels that are considered to lie on the line. The resulting direction is mainly used to find corresponding lines in other images, as well as finding corresponding object lines.<\/p>\n<\/dd>\n<dt><strong>Digit length<\/strong><\/dt>\n<dd>Stores the length of the line. It is increased for every pixel that is added to the line.<\/p>\n<\/dd>\n<dt><strong>Digit counterX<\/strong><\/dt>\n<dd>Counter of steps in x direction. It is increased or decreased in every iteration, dependently on the chosen direction.<\/p>\n<\/dd>\n<dt><strong>Digit counterY<\/strong><\/dt>\n<dd>Counter of steps in y direction. It is increased or decreased in every iteration, dependently on the chosen direction.<\/p>\n<\/dd>\n<dt><strong>Digit disparity<\/strong><\/dt>\n<dd>Disparity, <img loading=\"lazy\" width=\"24\" height=\"19\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img215.png\" alt=\"$ infty$\"\/> if no disparity is found, or the disparity in pixels if a corresponding line has been found.<\/p>\n<\/dd>\n<dt><strong>Real hitRateDisp<\/strong><\/dt>\n<dd>Stores the rating of the correspondence between this line and a line in the other image. The line with the best rating is chosen, otherwise the rating is set to a value which is equivalent to <img loading=\"lazy\" width=\"24\" height=\"19\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img215.png\" alt=\"$ infty$\"\/>.<\/p>\n<\/dd>\n<dt><strong>Real  hitRateObj<\/strong><\/dt>\n<dd>is the quality of the found object line or <img loading=\"lazy\" width=\"24\" height=\"19\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img215.png\" alt=\"$ infty$\"\/> if no line is found.<\/p>\n<\/dd>\n<dt><strong>Real xw<\/strong><\/dt>\n<dd>Stores the x-coordinate of the line in the world coordinate system.<\/p>\n<\/dd>\n<dt><strong>Real yw<\/strong><\/dt>\n<dd>Stores the y-coordinate of the line in the world coordinate system.<\/p>\n<\/dd>\n<dt><strong>Real zw<\/strong><\/dt>\n<dd>Stores the z-coordinate of the line in the world coordinate system.<\/p>\n<\/dd>\n<dt><strong>LineList* next<\/strong><\/dt>\n<dd>Pointer to the next element of the line list or NULL at the end of the list.<\/p>\n<\/dd>\n<dt><strong>LineList* corrEdge<\/strong><\/dt>\n<dd>Pointer to the corresponding line in the other image or NULL if no line is found.<\/p>\n<\/dd>\n<dt><strong>EdgeList* corrObj<\/strong><\/dt>\n<dd>Pointer to a line that seems to belong to the other side of this line i.e. the two lines of a goal or a robot.\n<\/dd>\n<\/dl>\n<p>\nFirst of all everything is set to 0, except the disparity and both hit rates, which are all set to <img loading=\"lazy\" width=\"24\" height=\"19\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img215.png\" alt=\"$ infty$\"\/>. A LIFO (last in, first out) list <img loading=\"lazy\" width=\"16\" height=\"20\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img216.png\" alt=\"$ vartheta$\"\/> of length <img loading=\"lazy\" width=\"13\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img217.png\" alt=\"$ varsigma$\"\/> is created, which stores the chosen directions. The algorithm controls every pixel in the image whether it is an edge pixel. The search starts at the top-left of the image and searches from left to right and top to bottom. For vertical lines it is proven that when an edge pixel is found and it belongs to a line, the pixel is the first point of the line. This is not true for lines that are almost horizontal, but it can be ignored because horizontal lines cannot be used to calculate disparity and thus they are not searched for.<br \/>\nIf an edge pixel is found and it is not already processed, the start and end points of the line list are set to its coordinate. Then the algorithm tries to follow the edge pixels, starting from the actual point, until the length of the line has reached a given threshold <img loading=\"lazy\" width=\"13\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img217.png\" alt=\"$ varsigma$\"\/>. During the process of following a line, pixels that seem to be more likely to lie on a straight line are preferred. This is necessary, otherwise the algorithm would always prefer a given direction.<br \/>\nIf a connection between a line point and one of its neighbour points, that can be used to continue the search, exists, the direction in which the new point can be found is stored. See Table <a href=\"#directions\">3.2<\/a> for possible directions and their encodings.\n<\/p>\n<p\/>\n<div align=\"CENTER\"><a name=\"1671\"\/><\/p>\n<table>\n<caption><strong>Table 3.2:<\/strong><br \/>\nEncoding of directions<\/caption>\n<tr>\n<td>\n<div align=\"CENTER\">\n<table cellpadding=\"3\" border=\"1\">\n<tr>\n<td align=\"CENTER\"><font size=\"-1\">left, up \t<\/font><\/td>\n<td align=\"CENTER\"><font size=\"-1\">  \t\tup \t\t<\/font><\/td>\n<td align=\"CENTER\"><font size=\"-1\">  \tright, up  \t\t<\/font><\/td>\n<\/tr>\n<tr>\n<td align=\"CENTER\"><font size=\"-1\"><br \/>\n 7\t\t\t<\/font><\/td>\n<td align=\"CENTER\"><font size=\"-1\">\t\t8  \t\t<\/font><\/td>\n<td align=\"CENTER\"><font size=\"-1\">\t\t9\t\t\t<\/font><\/td>\n<\/tr>\n<tr>\n<td align=\"CENTER\"><font size=\"-1\"> <\/p>\n<p> left \t\t<\/font><\/td>\n<td align=\"CENTER\"><font size=\"-1\">  \t\tCenter  <\/font><\/td>\n<td align=\"CENTER\"><font size=\"-1\"> \tright \t\t\t<\/font><\/td>\n<\/tr>\n<tr>\n<td align=\"CENTER\"><font size=\"-1\"><br \/>\n 4 \t  \t\t<\/font><\/td>\n<td align=\"CENTER\"><font size=\"-1\">\t\t\t\t<\/font><\/td>\n<td align=\"CENTER\"><font size=\"-1\">\t\t6 \t\t\t<\/font><\/td>\n<\/tr>\n<tr>\n<td align=\"CENTER\"><font size=\"-1\"> <\/p>\n<p> left, down <\/font><\/td>\n<td align=\"CENTER\"><font size=\"-1\">\t\t \t\t<\/font><\/td>\n<td align=\"CENTER\"><font size=\"-1\"> right, down\t\t<\/font><\/td>\n<\/tr>\n<tr>\n<td align=\"CENTER\"><font size=\"-1\"><br \/>\n 1\t\t\t<\/font><\/td>\n<td align=\"CENTER\"><font size=\"-1\">\t\t\t\t<\/font><\/td>\n<td align=\"CENTER\"><font size=\"-1\"> \t3 \t\t\t\t<\/font><\/td>\n<\/tr>\n<tr>\n<td\/>\n<td\/>\n<td\/>\n<\/tr>\n<\/table>\n<p><font size=\"-1\"><\/p>\n<p> <a name=\"directions\"\/> <\/font><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p\/>\n<p>If no connection exists the algorithm stops and the pixels that are already in <img loading=\"lazy\" width=\"16\" height=\"20\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img216.png\" alt=\"$ vartheta$\"\/> will be marked as processed. Then it continues searching edge pixels that are not processed yet. But if the length of the line reaches the threshold <img loading=\"lazy\" width=\"13\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img217.png\" alt=\"$ varsigma$\"\/>, the attitude <img loading=\"lazy\" width=\"17\" height=\"19\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img47.png\" alt=\"$ alpha$\"\/> of the first part of the line is computed. <img loading=\"lazy\" width=\"16\" height=\"20\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img216.png\" alt=\"$ vartheta$\"\/> is now totally filled, that means if we add another direction, the oldest element will be shifted out of the list. Let us assume that <img loading=\"lazy\" width=\"21\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img218.png\" alt=\"$ c_x$\"\/> is the counter in x direction, <img loading=\"lazy\" width=\"21\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img219.png\" alt=\"$ c_y$\"\/> is the counter in y direction and <img loading=\"lazy\" width=\"16\" height=\"35\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img220.png\" alt=\"$ beta$\"\/> is a boolean variable, then <img loading=\"lazy\" width=\"17\" height=\"19\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img47.png\" alt=\"$ alpha$\"\/> can be computed as<\/p>\n<p\/>\n<div align=\"CENTER\"><a name=\"eq_attitude\"\/><!-- MATH\n begin{equation}\nalpha =\nbegin{cases}\nfrac{c_x}{c_y} qquad beta = false  & text{if $arrowvert c_y arrowvert > 2$} \nfrac{c_x}{c_y} qquad beta = true & text{if $arrowvert c_y arrowvert > 0$  & $arrowvert c_y arrowvert leq 2$} \n10  qquad beta = true & text{otherwise, ie. $arrowvert c_y arrowvert = 0$, $beta$  = true}\nend{cases}\nend{equation}\n --><\/p>\n<table cellpadding=\"0\" width=\"100%\" align=\"CENTER\">\n<tr valign=\"MIDDLE\">\n<td nowrap=\"nowrap\" align=\"CENTER\"><img loading=\"lazy\" width=\"475\" height=\"136\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img221.png\" alt=\"$displaystyle alpha = begin{cases}frac{c_x}{c_y} qquad beta = false &amp; tex...&#10;...xt{otherwise, ie. $arrowvert c_y arrowvert = 0$, $beta$ = true} end{cases}$\"\/><\/td>\n<td nowrap=\"nowrap\" width=\"10\" align=\"RIGHT\">\n(3.14)<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p><br clear=\"ALL\"\/><\/p>\n<p\/>\n<img loading=\"lazy\" width=\"17\" height=\"19\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img47.png\" alt=\"$ alpha$\"\/> is used as a reference to decide whether the following pixels belong to a straight line or not. We now have a line <img loading=\"lazy\" width=\"32\" height=\"35\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img222.png\" alt=\"$ l_{ref}$\"\/> with length <img loading=\"lazy\" width=\"13\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img217.png\" alt=\"$ varsigma$\"\/> and attitude <img loading=\"lazy\" width=\"17\" height=\"19\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img47.png\" alt=\"$ alpha$\"\/>. A second <i>EdgeList<\/i> <img loading=\"lazy\" width=\"19\" height=\"35\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img223.png\" alt=\"$ l_h$\"\/> is generated, whose starting point is equal to the end point of <img loading=\"lazy\" width=\"32\" height=\"35\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img222.png\" alt=\"$ l_{ref}$\"\/>. The algorithm does the same as before, it tries to follow the edge. If this is possible, <img loading=\"lazy\" width=\"19\" height=\"35\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img223.png\" alt=\"$ l_h$\"\/> stores the new end coordinate, its counters are increased and the new point is marked as processed. The chosen direction, in which the new edge pixel is situated is shifted into the <img loading=\"lazy\" width=\"16\" height=\"20\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img216.png\" alt=\"$ vartheta$\"\/> list, thus the oldest element is lost. Until now, it is not clear if the new added point belongs to the line <img loading=\"lazy\" width=\"32\" height=\"35\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img222.png\" alt=\"$ l_{ref}$\"\/>, thus the points added are stored in a separate list. This is needed, because otherwise a lot of points would be lost during the search process<a name=\"tex2html37\" href=\"footnode.html#foot1691\"><sup>3.5<\/sup><\/a>. With the aid of <img loading=\"lazy\" width=\"16\" height=\"20\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img216.png\" alt=\"$ vartheta$\"\/> we calculate a new attitude <img loading=\"lazy\" width=\"21\" height=\"17\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img224.png\" alt=\"$ alpha'$\"\/>. The computation is the same as shown in Equation <a href=\"#eq_attitude\">3.14<\/a>. One could ask why not compare the attitude of the whole line with the reference line. If the whole line would be compared, the computation of <img loading=\"lazy\" width=\"21\" height=\"17\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img224.png\" alt=\"$ alpha'$\"\/> would not be that significant. By computing the new attitude with <img loading=\"lazy\" width=\"16\" height=\"20\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img216.png\" alt=\"$ vartheta$\"\/> it is proved that only the last part of the line is incorporated. If the absolute difference of both attitudes <!-- MATH\n $arrowvert alpha - alpha' arrowvert$\n --><br \/>\n<img loading=\"lazy\" width=\"67\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img225.png\" alt=\"$ arrowvert alpha - alpha' arrowvert$\"\/> is below a lower threshold <img loading=\"lazy\" width=\"18\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img226.png\" alt=\"$ tau_l$\"\/>, the points that are not on the list are added to the list and marked as processed. The information needed is stored in <img loading=\"lazy\" width=\"19\" height=\"35\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img223.png\" alt=\"$ l_h$\"\/>. The list which stores the points is emptied, because now it is clear that these points belong to the line. Otherwise, if the difference is below a high threshold <img loading=\"lazy\" width=\"21\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img227.png\" alt=\"$ tau_h$\"\/> the search continuous. <img loading=\"lazy\" width=\"21\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img227.png\" alt=\"$ tau_h$\"\/> is used to handle the given noise. When <img loading=\"lazy\" width=\"18\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img226.png\" alt=\"$ tau_l$\"\/> is very low, the distance between a point and the line is only allowed to be very small thus noise can lead to the end of the search. With the use of <img loading=\"lazy\" width=\"21\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img227.png\" alt=\"$ tau_h$\"\/> a higher variance is allowed, but only to follow the edge. To gain access to the line, in sum the change in direction has to be low. Only pixels that belong to the line are marked as processed. If the difference is higher as <img loading=\"lazy\" width=\"21\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img227.png\" alt=\"$ tau_h$\"\/> the search is finished. The line is kept, if its length is higher than the minimum length accepted. If the line is accepted, a new <i>LineList<\/i> is generated and the old one points to the new one.<\/p>\n<p>A linear list of lines is the result of this procedure.  Figure <a href=\"#gen_lines\">3.9<\/a> shows an image in which straight lines are searched.<\/p>\n<div align=\"CENTER\"><a name=\"gen_lines\"\/><a name=\"1697\"\/><\/p>\n<table>\n<caption align=\"BOTTOM\"><strong>Figure 3.9:<\/strong><br \/>\nResults of the line extraction, horizontal lines are dismissed. Found lines are plotted in red, start points are green and the end points are blue (colors can only be seen in the electronic version of this thesis).<\/caption>\n<tr>\n<td>\n<div align=\"CENTER\">\n <img loading=\"lazy\" width=\"507\" height=\"447\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/gen_lines.jpg\" alt=\"Image gen_lines\"\/><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>Unfortunately, edge pixels are not always connected. Thus, after the line list has been generated it tries to connect lines if they have approximately the same attitude, e.g. the absolute difference of two lines is below a threshold, and the end point of one line is near the start point of the other or vice versa.<\/p>\n<hr\/>\n<p><!--Navigation Panel--><b> Next:<\/b> <a name=\"tex2html517\" href=\"https:\/\/www.anagram.at\/diplomarbeit\/correspondence-analysis-2\/\">Correspondence Analysis<\/a><br \/>\n<b> Up:<\/b> <a name=\"tex2html513\" href=\"https:\/\/www.anagram.at\/diplomarbeit\/methods\/\">Methods<\/a><br \/>\n<!--End of Navigation Panel--><\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Line Extraction<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1946,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":""},"categories":[],"featured_image_src":null,"featured_image_src_square":null,"_links":{"self":[{"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/pages\/1967"}],"collection":[{"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/comments?post=1967"}],"version-history":[{"count":0,"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/pages\/1967\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/pages\/1946"}],"wp:attachment":[{"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/media?parent=1967"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/categories?post=1967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}