title: OpenCV: Extracting Triangles from Delaunay Triangulation
body: <p>I am using NetBeans 7.1 on Ubuntu 11.04 and would like to obtain triangles from a set of points using OpenCV.  I build the Delaunay triangulation as follows.</p>
  
  <pre><code>CvMemStorage *storage;
  size_t      ptIndex;
  CvSubdiv2D* subdiv;
  
  storage = cvCreateMemStorage(0);
  subdiv =  cvCreateSubdivDelaunay2D( boundRect, storage );
  for (ptIndex = 0; ptIndex&lt;numPts; ptIndex++)
      cvSubdivDelaunay2DInsert(subdiv, points[ptIndex]);
  </code></pre>
  
  <p>That part seems to work OK.  It runs and the resulting storage looks like this.</p>
  
  <p>storage 0xb287a90<br>
  signature   1116274688<br>
  bottom  0x2a2d57a0<br>
  prev    0x0 
  next    0x2a2e5730<br>
  top 0x2cc947d0<br>
  prev    0x2cc84840<br>
  next    0x0 
  parent  0x0 
  signature<br>
  bottom<br>
  top<br>
  parent<br>
  block_size<br>
  free_space<br>
  block_size  65408<br>
  free_space  0    </p>
  
  <p>I have look at the documentation for these functions <a href="http://opencv.willowgarage.com/documentation/python/imgproc_planar_subdivisions.html#subdivdelaunay2dinsert" rel="nofollow">here</a> but cannot find any function for extracting the triangles.</p>
  
  <p>I would be most grateful if someone could tell me how to extract the triangles.</p>
  
  <p>Peter.</p>