Draw rectangle in OpenCV
<p>I want to draw a rectangle in OpenCV by using this function:</p>

<pre><code>rectangle(Mat&amp; img, Rect rec, const Scalar&amp; color, int thickness=1, int lineType=8, int shift=0 )
</code></pre>

<p>But when I use it I am facing some errors. My question is: can anyone explain the function with an example? I found some examples but with another function: </p>

<pre><code>rectangle(Mat&amp; img, Point pt1, Point pt2, const Scalar&amp; color, int thickness=1, int lineType=8, int shift=0)
</code></pre>

<p>This example on the second function: </p>

<pre><code>rectangle(image, pt2, pt1, Scalar(0, 255, 0), 2, 8, 0);
</code></pre>

<p>This function I understand, but with the first function I'm facing a problem in parameter <code>Rect</code>. I don't know how I can deadlier it?</p>