title: Trying to draw vertical line down middle of live video frame using opencv (c++)
body: <p>This seems like it should be perfectly simple, but for some reason my line isn't centered - it's farther to the left than it should be.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>static const int width = 240;
  static const int height = 320;
  
  VideoCapture cap(0);
  cap.set(CV_CAP_PROP_FRAME_WIDTH, width);
  cap.set(CV_CAP_PROP_FRAME_HEIGHT, height);
  
  //Set points for center line
  CvPoint mid_bottom, mid_top;
  mid_bottom.x = width/2;
  mid_bottom.y = 0;
  mid_top.x = width/2;
  mid_top.y = height;
  
  //for purposes not related to this issue, I have to use IplImages instead of Mats
  Mat frame; //(edit - forgot this declaration before, sorry!)
  cap &gt;&gt; frame;
  IplImage frame_ipl = frame;
  
  //drawing the line
  cvLine(&amp;frame_ipl, mid_bottom, mid_top, RED, 2);
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/fGTtU.jpg" alt="The result:"></p>
  
  <p>Any thoughts as to why this is going wrong?</p>