OpenCV: How to get the bounding box for each contour?
<p>** ~ Updated ~ ** 
Hi , I have a source file and i converted it to below picture , and i have a contour in my program</p>

<p><img src="https://i.stack.imgur.com/rw5mb.png" alt=""></p>

<pre><code>void find_contour(int, void*, Mat _mat)
{
    Mat edge_detect_canny;
    vector&lt;vector&lt;Point&gt; &gt; contours;
    vector&lt;Vec4i&gt; hierarchy;
    findContours(_mat, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));
    Mat drawing = Mat::zeros(_mat.size(), CV_8UC3);
    for (int i = 0; i &lt; contours.size(); i++)
        {
        Scalar color = Scalar(rng.uniform(0, 255), rng.uniform(0, 255), rng.uniform(0, 255));
        drawContours(drawing, contours, i, color, 1, 8, hierarchy, 1, Point());
        }
    IMshow(drawing, "draw-Res", 0);
    imwrite("c:\\draw.bmp", drawing);
    int cs = contours.size();
    cout &lt;&lt; cs &lt;&lt; "contour.size" &lt;&lt; endl;
}
</code></pre>

<p>that works fine but i want to add bounding box,find the bounding box for each contour to select all of my objects.
What should I do?</p>