title: Normalize car plate for OCR in OpenCV C++
body: <p>I'm doing some simple OCR car plate recognition system. I'm using HaarCascades to find car plate, and next i need to normalize this plate, to put it into my OCR module. I'm using floodfill to find main contours of a car plate, and then i perform Hough transform, to find upper and lower boarders of a car plate:</p>
  
  <p><img src="https://i.stack.imgur.com/bE2rd.jpg" alt="floodfill"></p>
  
  <p><img src="https://i.stack.imgur.com/Dpb6H.jpg" alt="Hough"></p>
  
  <p>Here's a part of code, where i perform Hough transform^</p>
  
  <pre><code>HoughLinesP(canny_img, lines, 1, CV_PI/180, 80, 80, 30 );
  
      for ( size_t i = 0; i &lt; lines.size(); i++ ) {  
          line (output, Point(lines[i][0], lines[i][3]), Point(lines[i][4], lines[i][5]), Scalar(0,0,255), 1, 8 );
      }
  </code></pre>
  
  <p>Now i need to cut and rotate this picture along this two lines. How can i do this?  i understand that i need to use point Point(lines[i][0])..Point(lines<a href="https://i.stack.imgur.com/bE2rd.jpg" rel="nofollow noreferrer">i</a>), but what i should do with them?</p>
  
  <p>So basically, i need to get something like that:</p>
  
  <ol>
  <li>Image, that i got using HaarCascades</li>
  </ol>
  
  <p><img src="https://i.stack.imgur.com/KcWqe.jpg" alt="enter image description here"></p>
  
  <ol start="2">
  <li>After some transformation i need to get something like this:
  <img src="https://i.stack.imgur.com/jYK7a.jpg" alt="enter image description here"></li>
  </ol>
  
  <p>So at the first step i need to cut only upper and lower boarders.</p>