title: roipoly matlab function equivalent in OpenCV
body: <p>I am converting a matlab code into C++ using OpenCV libraries.</p>
  
  <p><strong>Can anyone tell me <a href="http://www.mathworks.in/help/images/ref/roipoly.html" rel="nofollow">roipoly</a> matlab function equivalent in OpenCV??</strong></p>
  
  <p><strong>Or how to get the same functionality using OpenCV?</strong></p>
  
  <pre><code>BW = roipoly(I, c, r)
  </code></pre>
  
  <p>BW = roipoly(I, c, r) returns the ROI specified by the polygon described by vectors c and r, which specify the column and row indices of each vertex, respectively. c and r are of same size.</p>
  
  <p>In my case I want to extract <strong>triangular roi</strong> from the image, so c and r are of size 3x1.</p>
  
  <p>Can anyone tell me how to do this in C++ using OpenCV??</p>