title: detecting 2 lines opencv
body: <p>I have an image on which I run a dilation, and works fine, now I want to detect two dick lines on it :</p>
  
  <p><img src="https://i.stack.imgur.com/T7u6v.jpg" alt="DilationResult"></p>
  
  <p>and when run on it the part of code:</p>
  
  <pre><code>    cv::Canny(dilationResult,canny,50,200,3);
      cv::cvtColor(dilationResult,dilationResult,CV_BGR2GRAY);
      cv::HoughLines(canny,lines,30,CV_PI/180,500,0);
      cv::cvtColor(mask,mask,CV_GRAY2BGR);
          if(lines.size()!=0){
                  std::cout &lt;&lt; " line Size " &lt;&lt; lines.size()&lt;&lt; std::endl;
      for( size_t i = 0; i &lt; lines.size(); i++ )
          {
            float rho = lines[i][0], theta = lines[i][2];
            cv::Point pt1, pt2;
            double a = cos(theta), b = sin(theta);
            double x0 = a*rho, y0 = b*rho;
            pt1.x = cvRound(x0 + 1000*(-b));
            pt1.y = cvRound(y0 + 1000*(a));
            pt2.x = cvRound(x0 - 1000*(-b));
            pt2.y = cvRound(y0 - 1000*(a));
            angle = atan2f((pt2.y-pt1.y),(pt2.x-pt1.x))*180.0/CV_PI;
            std::cout &lt;&lt; "angle " &lt;&lt; angle&lt;&lt; std::endl;
            line( mask, pt1, pt2, cv::Scalar(0,0,255), 3, CV_AA);
          }
      }
      cv::imshow("mask " ,mask);
  </code></pre>
  
  <p>here's the result:</p>
  
  <p><img src="https://i.stack.imgur.com/k313K.jpg" alt="detection result"></p>
  
  <p>what I would like to get is something like this : </p>
  
  <p><img src="https://i.stack.imgur.com/hAlKA.jpg" alt="the perfect result"> </p>
  
  <p>getting only 2 lines that have the same width, and by the way I don't want to use <code>findcontour</code> function </p>
  
  <p>any idea how can do this ! </p>