title: How to get points from a line in OpenCV?
body: <p>The <code>cvLine()</code> function can draw a straight line given two points P1(x1,y1) and P2(x2,y2). What I'm stuck at is getting the points on this line instead of drawing it straight away.</p>
  
  <p>Suppose I draw a line (in green) AB and another line AC. If I follow all the pixels on line AB there will be a point where I encounter black pixels (the border of the circle that encloses A) before I reach B.</p>
  
  <p>Again when traveling along the pixels on line AC black pixels will be encountered twice.</p>
  
  <p><img src="https://i.stack.imgur.com/Sd5M9.jpg" alt="line points"></p>
  
  <p>Basically I'm trying to get the points on the (green) lines, but <code>cvLine()</code> doesn't seem to return any point sequence structure. Is there any way to get these points using OpenCV?</p>
  
  <p>A rather dumb approach would be to draw the line using <code>cvLine()</code> on a separate image, then find contours on it, then traverse that contour's <code>CvSeq*</code> (the line drawn) for the points. Both the scratch image and the original image being of same size we'd be getting the points' positions. Like I said, kinda dumb. Any enlightened approach would be great!</p>