convert Rect to vector<Point>
<p>I am using OpenCV and need to convert a <code>cv::Rect</code> to a <code>std::vector&lt;cv::Point&gt;</code> of all the points in the <code>Rect</code>.</p>

<p>I wonder if there is a method that can do this?
If not, how can I populate the <code>std::vector</code> with my points?</p>

<p>I tried adding the points in the constructor, but it fails:</p>

<pre><code>cv::Rect rect
std::vector&lt;cv::Point&gt; _contour(rect.tl(),rect.br());
</code></pre>

<p>the error I'm getting is </p>

<blockquote>
  <p>no instance of constructor "std::vector&lt;_Ty, _Alloc>::vector [with
  _Ty=cv::Point, _Alloc=std::allocator]" matches the argument list</p>
</blockquote>

<p>I tried to add the points using the <code>insert</code> function, but this fails too:</p>

<pre><code>cv::Rect rect
std::vector&lt;cv::Point&gt; _contour;
_contour.insert(rect.tl());
</code></pre>

<p>the error I'm getting is:</p>

<blockquote>
  <p>no instance of overloaded function "std::vector&lt;_Ty, _Alloc>::insert
  [with _Ty=cv::Point, _Alloc=std::allocator]" matches the
  argument list</p>
</blockquote>

<p>Thanks</p>