title: bird's eye view opencv
body: <p>I want to get Bird's eye view of an image that I took with my camera, so that only the white lanes are shown. The resolution is 640x480. Here is the image - <a href="https://i.stack.imgur.com/PXQTE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PXQTE.jpg" alt="image from camera"></a>
  What I do is first apply histogram equalizer and binary threshold,then define the 4 coordinates that I will use in getPerspectiveTransform and the result coordinates. </p>
  
  <pre><code>    int bottom_leftx = 110;
      int bottom_lefty = 480;
  
      int upper_leftx = 260;
      int upper_lefty = 120;
  
      int upper_rightx = 410;
      int upper_righty = 120;
  
      int bottom_rightx = 560;
      int bottom_righty = 480;
  
  
      Point2f src_vertices[4];
      src_vertices[0] = Point(bottom_leftx, bottom_lefty);
      src_vertices[1] = Point(upper_leftx, upper_lefty);
      src_vertices[2] = Point(upper_righty, upper_righty);
      src_vertices[3] = Point(bottom_rightx, bottom_righty);
  
  
      Point2f dst_vertices[4];
      dst_vertices[0] = Point(0, 480);
      dst_vertices[1] = Point(0, 0);
      dst_vertices[2] = Point(640, 0);
      dst_vertices[3] = Point(640, 480);
  </code></pre>
  
  <p>Then apply warpPerspective - </p>
  
  <pre><code>void getBirdView(Point2f *p1, Point2f *p2, const Mat&amp; src, Mat&amp; dst) {
      Mat warpMatrix = getPerspectiveTransform(p1, p2);
  
      warpPerspective(src, dst, warpMatrix, dst.size(), INTER_LINEAR, BORDER_CONSTANT);
  }
  </code></pre>
  
  <p>And instead of getting only the two parallel lines, I am getting that - 
  <a href="https://i.stack.imgur.com/rQ4dx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rQ4dx.png" alt="enter image description here"></a></p>
  
  <p>So how did that white color come to my result? Where am I wrong? </p>